chef_gem installing with wrong rubygems


#1

I just upgraded from running 0.10.8 with ruby 1.8.7 installed on the system to
the omnibus 10.18.2. I have a recipe running chef_gem to install a gem and chef
can see that the gem is not in the omnibus rubygems, so it installs it. But it
installs it into the system rubygems. Even if I run chef-client again it sees
the gem is not in omnibus and then installs it in the system. If I remove
/usr/bin/gem then chef will install it inside omnibus. I thought chef_gem was
supposed to ignore /usr/bin/gem. Has anyone seen this, or know how to work
around it, or know what I may be doing wrong?

I’m running Centos 5.4 as root with
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root]# gem list netaddr

*** LOCAL GEMS ***

[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]# chef-client -l debug

[2013-02-06T21:01:41+00:00] INFO: Processing chef_gem[netaddr] action install
(cookbook::recipe line 2)
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] detected omnibus
installation in /opt/chef/embedded/bin
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] using gem from running
ruby environment
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] no installed version found
for netaddr (>= 0)
[2013-02-06T21:01:43+00:00] DEBUG: found gem netaddr version 1.5.0 for
platform ruby from http://rubygems.org/
Successfully installed netaddr-1.5.0
1 gem installed

[root]# gem list netaddr

*** LOCAL GEMS ***

netaddr (1.5.0)
[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]#

Thanks,
Dan


#2

I seeing a similar behavior - Also to the other post on chef_gem with
the minitest-handler

At first run, this fails complaining it can’t install the chef_gem.
On second run this works correctly.

On 06/02/13 23:08, dan@nemecfamily.com wrote:

I just upgraded from running 0.10.8 with ruby 1.8.7 installed on the system to
the omnibus 10.18.2. I have a recipe running chef_gem to install a gem and chef
can see that the gem is not in the omnibus rubygems, so it installs it. But it
installs it into the system rubygems. Even if I run chef-client again it sees
the gem is not in omnibus and then installs it in the system. If I remove
/usr/bin/gem then chef will install it inside omnibus. I thought chef_gem was
supposed to ignore /usr/bin/gem. Has anyone seen this, or know how to work
around it, or know what I may be doing wrong?

I’m running Centos 5.4 as root with
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root]# gem list netaddr

*** LOCAL GEMS ***

[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]# chef-client -l debug

[2013-02-06T21:01:41+00:00] INFO: Processing chef_gem[netaddr] action install
(cookbook::recipe line 2)
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] detected omnibus
installation in /opt/chef/embedded/bin
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] using gem from running
ruby environment
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] no installed version found
for netaddr (>= 0)
[2013-02-06T21:01:43+00:00] DEBUG: found gem netaddr version 1.5.0 for
platform ruby from http://rubygems.org/
Successfully installed netaddr-1.5.0
1 gem installed

[root]# gem list netaddr

*** LOCAL GEMS ***

netaddr (1.5.0)
[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]#

Thanks,
Dan


#3

Maybe on a related note:

I know you can pass the – -v , but how do version the
omnibus version?
Maybe something changed there ?

On 07/02/13 11:30, Patrick Debois wrote:

I seeing a similar behavior - Also to the other post on chef_gem with
the minitest-handler

At first run, this fails complaining it can’t install the chef_gem.
On second run this works correctly.

On 06/02/13 23:08, dan@nemecfamily.com wrote:

I just upgraded from running 0.10.8 with ruby 1.8.7 installed on the
system to
the omnibus 10.18.2. I have a recipe running chef_gem to install a
gem and chef
can see that the gem is not in the omnibus rubygems, so it installs
it. But it
installs it into the system rubygems. Even if I run chef-client again
it sees
the gem is not in omnibus and then installs it in the system. If I
remove
/usr/bin/gem then chef will install it inside omnibus. I thought
chef_gem was
supposed to ignore /usr/bin/gem. Has anyone seen this, or know how to
work
around it, or know what I may be doing wrong?

I’m running Centos 5.4 as root with
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root]# gem list netaddr

*** LOCAL GEMS ***

[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]# chef-client -l debug

[2013-02-06T21:01:41+00:00] INFO: Processing chef_gem[netaddr] action
install
(cookbook::recipe line 2)
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] detected omnibus
installation in /opt/chef/embedded/bin
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] using gem from
running
ruby environment
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] no installed
version found
for netaddr (>= 0)
[2013-02-06T21:01:43+00:00] DEBUG: found gem netaddr version 1.5.0 for
platform ruby from http://rubygems.org/
Successfully installed netaddr-1.5.0
1 gem installed

[root]# gem list netaddr

*** LOCAL GEMS ***

netaddr (1.5.0)
[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]#

Thanks,
Dan


#4

I’ve further tested the behavior with running the system recreate 20
times with vagrant - and it failed 7 out 20.

I found that the problem had to do with an intermittently available
http://rubygems.org
So sometimes the gem install would succeed and other times not.

Not a lot chef can do about that - just for reference:


– Chef - run output –
[2013-02-07T11:05:26+00:00] INFO: Processing chef_gem[simple-graphite]
action install (graphite_handler::default line 20)
[2013-02-07T11:05:26+00:00] WARN: failed to find gem simple-graphite
(>= 0) from [http://rubygems.org/]

Then I dig deeper in the gem problem by executing the embedded gem manually

– First invocation – Fails
root@vagrant-server:/opt/chef# ./embedded/bin/gem install simple-graphite
ERROR: Could not find a valid gem ‘simple-graphite’ (>= 0) in any
repository
ERROR: Possible alternatives: simple-graphite

– Second invocation (without any other changes) – Succeeds
root@vagrant-server:/opt/chef# ./embedded/bin/gem install simple-graphite
Fetching: simple-graphite-1.1.1.gem (100%)
Successfully installed simple-graphite-1.1.1
1 gem installed
Installing ri documentation for simple-graphite-1.1.1…
Installing RDoc documentation for simple-graphite-1.1.1…

On 07/02/13 11:49, Patrick Debois wrote:

Maybe on a related note:

I know you can pass the – -v , but how do version the
omnibus version?
Maybe something changed there ?

On 07/02/13 11:30, Patrick Debois wrote:

I seeing a similar behavior - Also to the other post on chef_gem with
the minitest-handler

At first run, this fails complaining it can’t install the chef_gem.
On second run this works correctly.

On 06/02/13 23:08, dan@nemecfamily.com wrote:

I just upgraded from running 0.10.8 with ruby 1.8.7 installed on the
system to
the omnibus 10.18.2. I have a recipe running chef_gem to install a
gem and chef
can see that the gem is not in the omnibus rubygems, so it installs
it. But it
installs it into the system rubygems. Even if I run chef-client
again it sees
the gem is not in omnibus and then installs it in the system. If I
remove
/usr/bin/gem then chef will install it inside omnibus. I thought
chef_gem was
supposed to ignore /usr/bin/gem. Has anyone seen this, or know how
to work
around it, or know what I may be doing wrong?

I’m running Centos 5.4 as root with
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root]# gem list netaddr

*** LOCAL GEMS ***

[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]# chef-client -l debug

[2013-02-06T21:01:41+00:00] INFO: Processing chef_gem[netaddr]
action install
(cookbook::recipe line 2)
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] detected omnibus
installation in /opt/chef/embedded/bin
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] using gem from
running
ruby environment
[2013-02-06T21:01:41+00:00] DEBUG: chef_gem[netaddr] no installed
version found
for netaddr (>= 0)
[2013-02-06T21:01:43+00:00] DEBUG: found gem netaddr version 1.5.0 for
platform ruby from http://rubygems.org/
Successfully installed netaddr-1.5.0
1 gem installed

[root]# gem list netaddr

*** LOCAL GEMS ***

netaddr (1.5.0)
[root]# /opt/chef/embedded/bin/gem list netaddr

*** LOCAL GEMS ***

[root]#

Thanks,
Dan