OPERATING_SYSTEM_DEFAULTS are clobbered by ~/.gemrc
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with omnibus/files/rubygems-customization/default/operating_system.rb at the OPERATING_SYSTEM_DEFAULTS assignments, then reproduce the ~/.gemrc case using the provided gem install command. Compare this behavior with the GEM_* variables from chef shell-init. Done means custom ~/.gemrc settings no longer clobber ChefDK's intended user-install behavior.
Written by the indexing model from the issue text.
Description
Description
Users with custom ~/.gemrc files may clobber the flags set in OPERATING_SYSTEM_DEFAULTS.
In operating_system.rb:6 there are the following two lines:
# Always install and update new gems in "user install mode"
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS["install"] = "--user --no-document"
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS["update"] = "--user --no-document"
This behavior breaks using ChefDK as a plugin to things like rbenv-chefdk and other Ruby switchers.
To see how hard this is debug, look at the efforts I had to go through on docwhat/rbenv-chefdk#3
ChefDK Version
Chef Development Kit Version: 0.15.16
chef-client version: 12.11.18
delivery version: master (444effdf9c81908795e88157f01cd667a6c43b5f)
berks version: 4.3.5
kitchen version: 1.10.0
Platform Version
Any. But I'm testing on OS X
Replication Case
Create a ~/.gemrc file with these lines:
install: --no-document
update: --no-document
And then, in a shell that has not run chef shell-init run:
% /opt/chefdk/embedded/bin/gem install awesome_print
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /opt/chefdk/embedded/lib/ruby/gems/2.1.0 directory.
An easy way to reproduce this setup is to clone this gist and run ./fakehome.sh
Proposed solution
Remove the OPERATING_SYSTEM_DEFAULTS lines and instead add in the GEM_* environment variables from chef shell-init. Leave the user_dir alone, since it is useful.
- Dominant language
- Go
- Stars
- 156
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from chef/chef-workstation
-
Packaged Ruby is EOL Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
chef/chef-workstation#3624 ·
-
Status: Untriaged
Difficulty 4/5 3-5 days Newbie friendliness 35/100
chef/chef-workstation#3286 ·
-
Status: Untriaged
Difficulty 1/5 Under an hour Newbie friendliness 55/100
chef/chef-workstation#3284 · 5 comments ·
-
Status: Untriaged
Difficulty 3/5 1-2 days Newbie friendliness 35/100
chef/chef-workstation#3131 · 1 reaction ·
-
Status: Untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
chef/chef-workstation#3103 · 3 comments ·
All issues in chef/chef-workstation
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100