Those of us using RVM or other local ruby installs may have come across a
problem when using omnibus-chef 11. The issue is that the wrong gem path
can be pulled in from the local ruby and gem path and therefore chef
commands fail.
Vagrant gets around this by wrapping the vagrant command in a shell script
which sets the correct environment variables for ruby and gem paths before
calling the command directly thus ensuring the correct gem paths are set up
and embedded ruby is used.
This could easily be done in chef as shown below. My question is where can
I submit this as a contributed change? Comments on the methodology are
welcome.
I’ve made the following changes locally and tested them but cannot find
where in the code to put the changes to submit a pull request :
Install rubygems to /opt/chef/embedded/bin instead of /opt/chef/bin using
rubygems as it is done now resulting in :
The GEM_HOME could be set to the latest path gem path as part of the
install. Any other variables (GEMRC?) could be set here also.
Only symbolic links exist in /opt/chef/bin pointing at the wrapper
/opt/ohef/embedded/bin/chef-cmd-wrapper. Links are created relative rather
than absolute in case the root directory is different :
I like this approach, I've fought with this myself, but usually end up just
installing the chef gems instead of the omnibus.
I think the right place to change how things work is in the
omnibus-software project, in the chef build script:
Looks like the gem install is being hardcoded with a "-n
#{install_dir}/bin" when it should be allowed to go into embedded/bin,
which would be the first step.
The project that has the bits for actually building and packaging chef is:
Which pulls in the omnibus-software scripts.
Good luck!
Ben Bytheway
On Wed, May 29, 2013 at 8:50 PM, Andrew Hollingsworth adh@techopsguru.comwrote:
Hi all,
Those of us using RVM or other local ruby installs may have come across a
problem when using omnibus-chef 11. The issue is that the wrong gem path
can be pulled in from the local ruby and gem path and therefore chef
commands fail.
Vagrant gets around this by wrapping the vagrant command in a shell script
which sets the correct environment variables for ruby and gem paths before
calling the command directly thus ensuring the correct gem paths are set up
and embedded ruby is used.
This could easily be done in chef as shown below. My question is where can
I submit this as a contributed change? Comments on the methodology are
welcome.
I've made the following changes locally and tested them but cannot find
where in the code to put the changes to submit a pull request :
Install rubygems to /opt/chef/embedded/bin instead of /opt/chef/bin
using rubygems as it is done now resulting in :
The GEM_HOME could be set to the latest path gem path as part of the
install. Any other variables (GEMRC?) could be set here also.
Only symbolic links exist in /opt/chef/bin pointing at the wrapper
/opt/ohef/embedded/bin/chef-cmd-wrapper. Links are created relative rather
than absolute in case the root directory is different :
Yeah, I ended up de-installing RVM and just putting /opt/chef/embedded/bin
very high in my $PATH to work around this exact issue. (Which was only an
option because the only real Ruby work I do is Chef-related.) I originally
tried writing wrapper scripts for each command to work around it, but that
ended up being unwieldy and often broke due to dependencies.
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
Looks like the gem install is being hardcoded with a "-n
#{install_dir}/bin" when it should be allowed to go into embedded/bin,
which would be the first step.
The project that has the bits for actually building and packaging chef is:
Those of us using RVM or other local ruby installs may have come across a
problem when using omnibus-chef 11. The issue is that the wrong gem path
can be pulled in from the local ruby and gem path and therefore chef
commands fail.
Vagrant gets around this by wrapping the vagrant command in a shell
script which sets the correct environment variables for ruby and gem paths
before calling the command directly thus ensuring the correct gem paths are
set up and embedded ruby is used.
This could easily be done in chef as shown below. My question is where
can I submit this as a contributed change? Comments on the methodology are
welcome.
I've made the following changes locally and tested them but cannot find
where in the code to put the changes to submit a pull request :
Install rubygems to /opt/chef/embedded/bin instead of /opt/chef/bin
using rubygems as it is done now resulting in :
The GEM_HOME could be set to the latest path gem path as part of the
install. Any other variables (GEMRC?) could be set here also.
Only symbolic links exist in /opt/chef/bin pointing at the wrapper
/opt/ohef/embedded/bin/chef-cmd-wrapper. Links are created relative rather
than absolute in case the root directory is different :