test-kitchen / test-kitchen

Test Kitchen is an integration tool for developing and testing infrastructure code and software on isolated target platforms
Other
1.87k stars 586 forks source link

Support Chef-DK #443

Closed ringods closed 8 years ago

ringods commented 10 years ago

When running TK, the busser integration code tries to install the required tools in /opt/chef. It should detect either a Chef installation or a Chef Development Kit (Chef-DK) installation. The latter is installed under /opt/chefdk.

ringods commented 10 years ago

Even with configuring the ruby_bindir in my kitchen.yml file to point to the Chef-DK setup, the installation of busser fails on the test VM. The gem seems to install, but the busser script is nowhere to be found. Here is my setup:

And here is my output when running kitchen verify:

←[0m←[36m-----> Setting up <default-ubuntu-1204>...
Fetching: thor-0.19.0.gem (100%)←[36m
←[0mWARNING:  You don't have /home/vagrant/.chefdk/gem/ruby/2.1.0/bin in your PATH,←[36m
←[0m      gem executables will not run.←[36m
←[0mSuccessfully installed thor-0.19.0←[36m
Fetching: busser-0.6.2.gem (100%)←[36m
←[0mSuccessfully installed busser-0.6.2←[36m
←[0m2 gems installed←[36m
←[0msudo: /tmp/busser/gems/bin/busser: command not found←[36m
←[0msudo: /tmp/busser/bin/busser: command not found←[36m
←[0m←[31m>>>>>> Setup failed on instance <default-ubuntu-1204>.←[0m
←[31m>>>>>> Please see .kitchen/logs/default-ubuntu-1204.log for more details←[0m
←[31m>>>>>> ------Exception-------←[0m
←[31m>>>>>> Class: Kitchen::ActionFailed←[0m
←[31m>>>>>> Message: SSH exited (1) for command: [sh -c 'BUSSER_ROOT="/tmp/busser" GEM_HOME="/tmp/busser/gems" GEM_PATH=
"/tmp/busser/gems" GEM_CACHE="/tmp/busser/gems/cache" ; export BUSSER_ROOT GEM_HOME GEM_PATH GEM_CACHE; if ! sudo -E /op
t/chefdk/embedded/bin/gem list busser -i >/dev/null; then sudo -E /opt/chefdk/embedded/bin/gem install busser --no-rdoc
--no-ri; fi; gem_bindir=`/opt/chefdk/embedded/bin/ruby -rrubygems -e "puts Gem.bindir"`; sudo -E ${gem_bindir}/busser se
tup; sudo -E /tmp/busser/bin/busser plugin install busser-serverspec']←[0m
←[31m>>>>>> ----------------------←[0m

(Ignore the strange characters: color output is not supported on Windows)

jtimberman commented 10 years ago

It would be nice:

  1. To have ChefDK as an installation option. This would require passing the project option to the in Kitchen::Provisioner::ChefBase.
  2. To use the chef gem command to install the gems under the ChefDK ruby environment. Alternatively this could use the :ruby_bindir config option to /opt/chefdk/embedded/bin, or use chef shell-init to set the PATH.

In automating a test-kitchen setup for workstations, I'm finding I want these capabilities :).

ringods commented 10 years ago

Advice asked: what would the yaml config parameter should be named for passing the project option to Kitchen::Provisioner::ChefBase?

We now have require_chef_omnibus to point to the version to download. My suggestion would be to name it require_chef_omnibus_project that will only add the -P argument when this option is filled in. Otherwise, the install.sh script has chef as it's default value.

jtimberman commented 10 years ago

I'd say let's use chef_installer_options and one could use -P chefdk in their .kitchen.yml

e.g.,

chef_installer_options: "-P chefdk"
ringods commented 10 years ago

@jtimberman while a generic chef_installer_options option is not a bad idea, I was thinking of a more specific option to support the project option. Reason for that is when you specify multiple platforms, one with chef, another with chefdk, the latter also implies to have the busser ruby_bindir set to /opt/chefdk/embedded/bin. Should this be automatic, or left to the user in .kitchen.yml?

Side-question: can the busser ruby_bindir be configured per platform? E.g. a section called busser_config similar to driver_config?

ringods commented 10 years ago

@jtimberman bullet point 1 of your list is handled by pull request #489.

cheeseplus commented 8 years ago

Looks like this should be supported based on the above merges. Closing but feel free to open for any further specific features or bugs related.