Information Technology Reference
In-Depth Information
A great way to test to see if your recipe is idempotent is to run kitchen converge twice .
When a recipe has no unintended side effects, there should be 0 resources updated on the
second run.
Does our recipe pass the idempotency test? Sadly, no. Here's a sampling of the output from
an initial kitchen converge :
$ kitchen converge
-----> Starting Kitchen (v1.2.2.dev)
-----> Creating <default-centos65>...
...
Starting Chef Client, version 11.14.2
[2014-08-14T19:25:13-07:00] INFO: *** Chef 11.14.2 ***
[2014-08-14T19:25:13-07:00] INFO: Chef-client pid: 2387
[2014-08-14T19:25:15-07:00] INFO: Setting the run_list to
["recipe[enterprise-chef::default]"] from CLI options
[2014-08-14T19:25:15-07:00] INFO: Run List is
[recipe[enterprise-chef::default]]
[2014-08-14T19:25:15-07:00] INFO: Run List expands to
[enterprise-chef::default]
[2014-08-14T19:25:15-07:00] INFO: Starting Chef Run for default-centos65
[2014-08-14T19:25:15-07:00] INFO: Running start handlers
[2014-08-14T19:25:15-07:00] INFO: Start handlers complete.
Compiling Cookbooks...
Converging 3 resources
...
[2014-08-14T19:36:22-07:00] INFO: Chef Run complete in 666.814045747
seconds
Running handlers:
[2014-08-14T19:36:22-07:00] INFO: Running report handlers
Running handlers complete
[2014-08-14T19:36:22-07:00] INFO: Report handlers complete
Chef Client finished, 3/3 resources updated in 668.536290312 seconds
Finished converging <default-centos65> (11m59.64s).
-----> Kitchen is finished. (12m33.89s)
Here's the output from the second run. Chef mistakenly thinks there's still stuff it needs to
do—2/3 resources updated in this second run. If the recipe were truly idempotent, we'd see
0/3 resources updated. Chef would inspect the state of the system, recognize that nothing had
changed since the last run—no one touched the node between the two runs—and perform no
resource updates:
Search WWH ::




Custom Search