Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
puppet-agent 5.5.12, puppet-agent 6.4.0
-
Night's Watch
-
3
-
PR - 2019-05-02, PR - 2019-05-15, PR - 2019-05-29
-
Customer Feedback
-
Bug Fix
-
-
Needs Assessment
Description
As part of the build process for the puppet-agent package, we patch the RubyGems library to add an additional library location to the default GEM_PATH:
https://github.com/puppetlabs/puppet-runtime/blob/master/resources/patches/ruby_245/rubygems_add_puppet_vendor_dir_r2.4.patch
https://github.com/puppetlabs/puppet-runtime/blob/master/resources/patches/ruby_253/rubygems_add_puppet_vendor_dir_r2.5.patch
This directory holds gems that are shared between the Puppet agent and Puppet server. However, RubyGems is also designed to update its self to a newer version without requiring an upgrade of the core Ruby package. If the gem update --system command is used to perform this sort of upgrade, the newly installed RubyGems library will not have the patch that adds vendor_dir to the GEM_PATH.
Reproduction Case
- Install PE 2018.1.7 on CentOS 7
- Run /opt/puppetlabs/bin/puppet gem env to print out the GEM_PATH
- Upgrade RubyGems: /opt/puppetlabs/bin/puppet gem update --system
Outcome
Prior to the upgrade gem env includes the vendor_gems directory in the GEM PATHS section:
[root@pe-201817-master puppetserver]# /opt/puppetlabs/puppet/bin/gem env
|
RubyGems Environment:
|
- RUBYGEMS VERSION: 2.6.14.3
|
- RUBY VERSION: 2.4.5 (2018-10-18 patchlevel 335) [x86_64-linux]
|
- INSTALLATION DIRECTORY: /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0
|
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.4.0
|
- RUBY EXECUTABLE: /opt/puppetlabs/puppet/bin/ruby
|
- EXECUTABLE DIRECTORY: /opt/puppetlabs/puppet/bin
|
- SPEC CACHE DIRECTORY: /root/.gem/specs
|
- SYSTEM CONFIGURATION DIRECTORY: /opt/puppetlabs/puppet/etc
|
- RUBYGEMS PLATFORMS:
|
- ruby
|
- x86_64-linux
|
- GEM PATHS:
|
- /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0
|
- /root/.gem/ruby/2.4.0
|
- /opt/puppetlabs/puppet/lib/ruby/vendor_gems
|
- GEM CONFIGURATION:
|
- :update_sources => true
|
- :verbose => true
|
- :backtrace => false
|
- :bulk_threshold => 1000
|
- REMOTE SOURCES:
|
- https://rubygems.org/
|
- SHELL PATH:
|
- /usr/local/sbin
|
- /sbin
|
- /bin
|
- /usr/sbin
|
- /usr/bin
|
- /root/bin
|
- /usr/local/bin
|
- /opt/puppetlabs/bin
|
- /root/bin
|
After running the upgrade, gem env no longer includes the vendor_gems directory:
[root@pe-201817-master puppetserver]# /opt/puppetlabs/puppet/bin/gem env
|
RubyGems Environment:
|
- RUBYGEMS VERSION: 3.0.3
|
- RUBY VERSION: 2.4.5 (2018-10-18 patchlevel 335) [x86_64-linux]
|
- INSTALLATION DIRECTORY: /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0
|
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.4.0
|
- RUBY EXECUTABLE: /opt/puppetlabs/puppet/bin/ruby
|
- GIT EXECUTABLE:
|
- EXECUTABLE DIRECTORY: /opt/puppetlabs/puppet/bin
|
- SPEC CACHE DIRECTORY: /root/.gem/specs
|
- SYSTEM CONFIGURATION DIRECTORY: /opt/puppetlabs/puppet/etc
|
- RUBYGEMS PLATFORMS:
|
- ruby
|
- x86_64-linux
|
- GEM PATHS:
|
- /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0
|
- /root/.gem/ruby/2.4.0
|
- GEM CONFIGURATION:
|
- :update_sources => true
|
- :verbose => true
|
- :backtrace => false
|
- :bulk_threshold => 1000
|
- REMOTE SOURCES:
|
- https://rubygems.org/
|
- SHELL PATH:
|
- /usr/local/sbin
|
- /sbin
|
- /bin
|
- /usr/sbin
|
- /usr/bin
|
- /root/bin
|
- /usr/local/bin
|
- /opt/puppetlabs/bin
|
- /root/bin
|
PE's r10k binary stops working as the fast_gettext gem is inside the missing vendor_gems directory:
[root@pe-201817-master puppetserver]# /opt/puppetlabs/puppet/bin/r10k --help
|
/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'fast_gettext' (~> 1.1.0) among 40 total gem(s) (Gem::MissingSpecError)
|
Checked in 'GEM_PATH=/root/.gem/ruby/2.4.0:/opt/puppetlabs/puppet/lib/ruby/gems/2.4.0', execute `gem env` for more information
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1449:in `block in activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `each'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1420:in `activate'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `each'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1420:in `activate'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `each'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1420:in `activate'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1452:in `block in activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `each'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1438:in `activate_dependencies'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1420:in `activate'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems.rb:304:in `block in activate_bin_path'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems.rb:303:in `synchronize'
|
from /opt/puppetlabs/puppet/lib/ruby/site_ruby/2.4.0/rubygems.rb:303:in `activate_bin_path'
|
from /opt/puppetlabs/puppet/bin/r10k:23:in `<main>'
|
Expected Outcome
Runing gem update --system does not break everything.