busser-serverspec
busser-serverspec copied to clipboard
install_gem('bundler') without version fix ? - latest bundler v2 fails on ruby < v2.3
https://github.com/test-kitchen/busser-serverspec/blob/master/lib/busser/runner_plugin/serverspec.rb
bundler is installed - without a version ?
it would be nice to set version via OS env variable
I opened https://github.com/test-kitchen/busser-serverspec/pull/57 with a possible fix
Lot of discussion last week on #53
@nareiber - that ticket was closed, but does not help us as we use an older version of ruby ( ruby 2.1.8 included with chef 12.9.38). The Bundler 2.0.1 fix doesnt help as bundler 2.x still requires ruby 2.3.0 or later.
For us, using Puppet version 4.10.12 with Ruby version 2.1.9, the Bundler 2.0.1 fix does not help as well.
If anyone else is looking for a workaround, this is what we're doing (it's not pretty)
Instead of kitchen verify $suite
do:
kitchen verify $suite >dev/null 2>&1 || true
GEM_HOME=/var/tmp/busser/gems
kitchen exec $suite -c "sudo sh -c \"GEM_HOME=${GEM_HOME} GEM_PATH=${GEM_HOME} GEM_CACHE=${GEM_HOME}/cache /opt/chef/embedded/bin/ruby -e 'require %q(busser); require %q(busser/rubygems); Busser::RubyGems.install_gem(%q(bundler), %q(~> 1.17.0))'\""
kitchen verify $suite
(busser_path is set to /var/tmp/busser in our .kitchen.yml, replace with your busser_path as appropriate)
If anyone is interested in another workaround, i did this: https://rubygems.org/gems/busser-serverspec_eol. You can just move your tests from ../serverspec/
to ../serverspec_eol/
and it supports older chef versions and ruby < 2.3
We switch to inspec, because it did not need ruby in the destination system. It take some time to migrate the test files but works fine now.