Imagine I have the this yum_repository configuration
applied via chef.
If I change it to
and rerun chef, this change will not be applied, because the default action of :add does not do anything if the repository configuration file already exists on disk.
Imagine I read the documentation more carefully, see that the :update action "updates the repository", change my resource to
and rerun chef. This change will still not be applied, because the :update action does not do anything unless you are enabling or disabling the repository.
Imagine I have 2 machines,
If I run chef with the same desired state of
on them, I end up in a different state on each one
The only sane thing to do is to use the :create action, which will guarantee the desired state, but at the cost of wasting time recreating caches even when the resource hasn't changed.
1) :update doesn't do what is documented. Instead of just comparing the value of enabled, it should compare every parameter of the provider to what is on disk, and reconfigure the repository if any of them differ.
2) Having :add as the default action is not intuitive, since it's not how other resources in chef work (e.g. imagine if a template wasn't updated if the target file already existed on disk!). The default behavior I would expect is a combination of :add and a properly working :update- "create the repository file if it does not exist, and update the repository file if it does exist but does not match the configuration I defined".