The issue is that the old code is not proper chef style either and is actually wrong: the old code thinks that the Chef::Log.info and new_resource.updated_by_last_action(true) calls will only be used if the command is executed, which is not true. They will always be called, and this is what this is fixing.

Do you have any suggestion on how to fix this issue another way?