Just writing a quick post to document something that I only found in a really hidden email thread in the
Opscode lists.
I attended a really nice Chef Training today, that covered pretty much most of what is needed for cookbook testing and the main (and only) toolkit was ChefDK.
Getting home I was pretty excited and decided to try it to develop some useful cookbooks. Found most of what I needed
here.
But when trying to run, I bumped in a number of errors concerning Ruby gems. Later on I figured out in the mailing list (while googling the error) that this needs to be done :
echo 'eval "$(chef shell-init bash)"' >> ~/.bash_profile
Looks like that command spits the right environment with all the libraries and binaries in the right place. Once that's on your session's environment, everything should work. At least the Vagrant provisioner worked for me.
Later on I learnt that these steps are the "Documentation" linked in the page, but I found that maybe the "Deployment Procedure" could be more explicit (and somewhat decoupled on "how to use it" documentation).
So hopefully this will provide one more helpful result to google searches of people not seeing that at first.
==== Installing the Docker plugin ====
Installing plugins for Kitchen (main tool of the ChefDK) is pretty much installing the correspondent ruby module. It already comes with "test-kitchen" and "kitchen-vagrant". To support Docker you want to install "kitchen-docker"
There's one thing to note though -- that you have to eval the chef environment, that means that a number of things are not really in the system default locations, but on the ChefDK bootstrap. I learnt the hard way that simply "gem install kitchen-docker" doesn't help. In order to have your Kitchen well integrated into Docker you need to do this, only after you do the eval described above and load the right environment :
chef gem install kitchen-docker
On the same way, you can always "chef gem list" before and after you run that, just to make sure that things are in place (or not).
That should be it. Feel free to comment if there are any questions.