busser-serverspec icon indicating copy to clipboard operation
busser-serverspec copied to clipboard

install_gem('bundler') without version fix ? - latest bundler v2 fails on ruby < v2.3

Open ebgc opened this issue 6 years ago • 7 comments

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

ebgc avatar Jan 04 '19 15:01 ebgc

I opened https://github.com/test-kitchen/busser-serverspec/pull/57 with a possible fix

moodwrench avatar Jan 08 '19 17:01 moodwrench

Lot of discussion last week on #53

nareiber avatar Jan 08 '19 19:01 nareiber

@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.

moodwrench avatar Jan 08 '19 20:01 moodwrench

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.

renkin avatar Jan 09 '19 12:01 renkin

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)

harvimt avatar Jan 15 '19 00:01 harvimt

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

etherops avatar Feb 28 '19 21:02 etherops

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.

m41kc0d3 avatar Mar 01 '19 13:03 m41kc0d3