Skip to content

Instantly share code, notes, and snippets.

@biinari
Forked from mattjbarlow/gist:242b66cdae6938d34419
Last active April 15, 2016 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biinari/41ddc6eced8f1c42c00a7b0c98b9e868 to your computer and use it in GitHub Desktop.
Save biinari/41ddc6eced8f1c42c00a7b0c98b9e868 to your computer and use it in GitHub Desktop.
Chef Shell in Test Kitchen (assuming using chef_solo provisioner)
#!/bin/sh
set -e # fail on errors
set -x # trace on
RUNLIST="$1" # eg 'recipe[example],role[something]'
cd /tmp/kitchen
[ -f client.pem ] || ssh-keygen -P '' -f client.pem
sudo /opt/chef/embedded/bin/gem install chef-zero -v '4.5.0' # last version to not enforce ruby version >= 2.1.0
pgrep chef-zero >/dev/null || /opt/chef/embedded/bin/chef-zero -d
knife cookbook upload -a -c solo.rb
sudo -E chef-shell -z -c solo.rb -j dna.json -o "${RUNLIST}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment