[PA-2628] gem update --system breaks vendored gems Created: 2019/04/09 Updated: 2019/07/03 Resolved: 2019/05/27
|Affects Version/s:||puppet-agent 5.5.12, puppet-agent 6.4.0|
|Fix Version/s:||puppet-agent 5.5.16, puppet-agent 6.0.10, puppet-agent 6.4.3|
|Reporter:||Charlie Sharpsteen||Assignee:||Oana Tanasoiu|
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
|Sprint:||PR - 2019-05-02, PR - 2019-05-15, PR - 2019-05-29|
|Method Found:||Customer Feedback|
|Release Notes:||Bug Fix|
|Release Notes Summary:|| Bug: 'gem update --system' command for ruby that is in the puppet agent/PE project breaks other projects that depends on gems that are in vendor_ruby directory (ex. r10k).
Fix: created a file operating_system.rb in order for gem paths to always contain the path for vendor_ruby directory, even after update.
|QA Risk Assessment:||Needs Assessment|
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:
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.
Prior to the upgrade gem env includes the vendor_gems directory in the GEM PATHS section:
After running the upgrade, gem env no longer includes the vendor_gems directory:
PE's r10k binary stops working as the fast_gettext gem is inside the missing vendor_gems directory:
Runing gem update --system does not break everything.
|Comment by Charlie Sharpsteen [ 2019/04/09 ]|
Instead of patching defaults.rb it looks like we should be doing this sort of path customization by creating a rubygems/defaults/operating_system.rb file, for example at:
This is a documented location to modify values set in defaults.rb:
The RubyGems library loads this file when it starts up:
Putting the defaults here would allow an upgraded version of rubygems to automatically incorporate the GEM_PATH that Puppet needs.