chef / appbundler

Generate locked binstubs for ruby applications
Apache License 2.0
14 stars 10 forks source link

work around rubygems uninitialized constant error #40

Closed lamont-granquist closed 6 years ago

lamont-granquist commented 6 years ago

in at least rubygems 2.7.6 when two chef gems are installed (as an example, but i think the problem is generalized to other gems with two installed versions, but it repros nicely with two chef gems), instead of pinning a version a bundler bug makes us explode with

/opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems/dependency.rb:284:in `matching_specs': uninitialized constant Gem::BundlerVersionFinder (NameError)

which is rubygems/rubygems#2196

this works around the bug by doing the require here, protected with exception handling to not blow up on rubygems versions that don't have this class.

once 2.7.7 / 2.8.0 is released this code should probably be deleted (at the same time the exception means it shouldn't hurt anything).

Signed-off-by: Lamont Granquist lamont@scriptkiddie.org

lamont-granquist commented 6 years ago

see also chef/chef-dk#1526 for users hitting the problem.

and while we've never had a particularly good behavior on upgrade for chef-dk with old gems in /opt/chefdk and .chefdk this bug likely makes upgrades a big tirefire, which is why i think its a critical regression-ey kind of thing.

lamont-granquist commented 6 years ago

unit tests that are mostly just copypasta from code, sigh...

lamont-granquist commented 6 years ago

yeah the unit tests have just been broken for some time. need to be cleaned up, but not right now.