Change the AWS account to launch instances with Chef Test Kitchen
The Chef SDK contains Test Kitchen, that can launch server instances to test your Chef cookbooks. Test Kitchen uses the “chef_zero” provisioner to use your workstation as the virtual Chef server. To switch Test Kitchen to launch instances in…
Test Chef cookbooks locally on a virtual workstation
When you use a virtual machine to write your Chef cookbooks you may want to test them locally with Vagrant. This nested virtual machine cannot use a 64 bit operating system, because to run a 64 bit virtual machine, the host computer’s CPU has to…
Test your cookbook in Chef Test Kitchen against multiple versions of the Chef Client
In large environments, during the Chef Client version change, some older servers still run the prior version of the Chef Client, the newly created servers launch with the new version of the Chef Client. It is very important to test your cookbooks with…
Chef exit codes
Chef uses the standard RFC 062 exit codes. In your .kitchen.yml file, you can supply an array of exit codes in the “retry_on_exit_code” option to retry the operation in case the Chef script execution is interrupted. The usual values are…
FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe’s request.
When your Chef recipe requests a reboot using the “reboot” Chef resource, the output window shows an error message: Chef Client finished, …/… resources updated in … seconds […] WARN: Rebooting server at a…
Unable to satisfy constraints on package
When you make a change to the version restrictions in the metadata.rb file and execute berks install in your Chef cookbook directory, you may get the error message: Unable to satisfy constraints on package … due to solution constraint (…).…
Skip steps in an InSpec integration test based on Chef attribute values
To speed up the test of some complex recipes, I use an attribute to skip certain long-running installations when I only need to test the rest of the recipe. We will pass Chef Attribute values into an InSpec test using environment variables. Declare an…
Waiting for SSH service on …:22, retrying in 3 seconds
When you try to launch a new EC2 instance in AWS using Chef Test Kitchen and the process times out with the message: Waiting for SSH service on …:22, retrying in 3 seconds $$$$$$ [SSH] connection failed, terminating…
Failed to complete #create action: [undefined method `version’ for nil:NilClass] on …
When you execute kitchen converge to launch an EC2 instance in AWS with Chef Test Kitchen, you get the error message: >>>>> ——Exception——- >>>>>> Class: Kitchen::ActionFailed…
Could not load the ‘ec2’ driver from the load path
When you execute kitchen list and the driver in your .kitchen file is “ec2“, the following error message appears: >>>> ——Exception——- >>>>>> Class: Kitchen::ClientError…