Information Technology Reference
In-Depth Information
[2014-08-17T23:14:20-07:00] INFO: Report handlers complete
Chef Client finished, 2/3 resources updated in 26.532340506 seconds
Finished converging <default-centos65> (0m28.53s).
-----> Kitchen is finished. (0m29.20s)
We've shown that the package resource is idempotent . As we mentioned earlier, most default
Chef resources are. Notice that the remote_file resource is idempotent. It is reporting (up to
date) .
There are some issues with the package and execute resources, however, as on the second
kitchen converge run Chef:
1. Reinstalled the rpm package, unnecessarily
2. Executed chef-server-ctl reconfigure a second time
Let's fix these idempotency issues in our code now. Example A-4 has the final idempotent
version of the code.
The first issue is a common one that Chef developers encounter with the package resource
when they try to install from a downloaded rpm instead of using a package repository. In-
stead of using a package one-liner for a downloaded rpm , you need to tell the package re-
source to explicitly use the RPM provider via the provider attribute, and you need to tell it
where the source RPM is located using the source attribute, like so:
package package_name ddo
source package_local_path
provider Chef : :Provider :: Package : :Rpm
end
end
NOTE
You can use the rpm_package short name to specify the RPM provider to the package re-
source, if you prefer. The following code is equivalent to the preceding code:
rpm_package package_name ddo
source package_local_path
end
end
Search WWH ::




Custom Search