- From: Gilles Devaux <
>
- To:
- Subject: [chef] Re: Re: chef-client runs only locally as root
- Date: Thu, 11 Mar 2010 14:43:16 -0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=KLvjv44YOOEJ0v+5wHng31dWLPYb9Hi3tBjRsq3rGZXeMqzQS7faJCi3mx053JIcYZ /csjqwWioI+jZmg3TfmpDJq8fcvZ2fvQVN1k8mtca0JAMYjvTFf7TqK1Bw2tROwK/eb+ G+ixa51NKKlloSku8G04BVlLufg7viRfVGVSw=
More on this:
I added these:
ohai-0.5.0/lib/ohai/plugins/ruby.rb:25 (inside run_ruby)
Ohai::Log.info("path: #{ENV['PATH']}");
status, stdout, stderr = run_command(:command => 'which ruby');
[Thu, 11 Mar 2010 22:35:32 +0000] DEBUG: Loading plugin languages
[Thu, 11 Mar 2010 22:35:32 +0000] INFO: path: /usr/bin:/bin
[Thu, 11 Mar 2010 22:35:32 +0000] DEBUG: ---- Begin which ruby STDOUT ----
[Thu, 11 Mar 2010 22:35:32 +0000] DEBUG:
[Thu, 11 Mar 2010 22:35:32 +0000] DEBUG: ---- End which ruby STDOUT ----
[Thu, 11 Mar 2010 22:35:32 +0000] DEBUG: ---- Begin which ruby STDERR ----
[Thu, 11 Mar 2010 22:35:32 +0000] DEBUG: which: no ruby in (/usr/bin:/bin)
It seems ohai (or chef) runs inside a limited /usr/bin/env. Is there a way to
add path at runtime?
I have a workaround using symlinks but it's not ideal.
Thanks
--Gilles
On Mar 11, 2010, at 10:58 AM, Joshua Timberman wrote:
>
-----BEGIN PGP SIGNED MESSAGE-----
>
Hash: SHA1
>
>
Hello!
>
>
That error looks like one I ran into where 'ruby' wasn't in the $PATH,
>
though 'ruby1.8' was. Are you on a system like Debian that has separate
>
ruby1.8 and ruby packages, and 'ruby' isn't installed?
>
>
>
On Mar 11, 2010, at 11:18 AM, Gilles Devaux wrote:
>
>
> Hi,
>
>
>
> I am trying to execute chef-client remotely but I run into this exception:
>
>
>
> /usr/local/lib/ruby/gems/1.8/gems/ohai-0.5.0/lib/ohai/system.rb:121:in
>
> `join': can't convert nil into String (TypeError)
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/ohai-0.5.0/lib/ohai/system.rb:121:in
>
> `all_plugins'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/ohai-0.5.0/lib/ohai/system.rb:118:in
>
> `each'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/ohai-0.5.0/lib/ohai/system.rb:118:in
>
> `all_plugins'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/client.rb:121:in
>
> `run_ohai'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/client.rb:126:in
>
> `determine_node_name'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/client.rb:83:in
>
> `run'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/application/client.rb:204:in
>
> `run_application'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/application/client.rb:196:in
>
> `loop'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/application/client.rb:196:in
>
> `run_application'
>
> from
>
> /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/application.rb:57:in
>
> `run'
>
> from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/chef-client:26
>
> from /usr/local/bin/chef-client:19:in `load'
>
> from /usr/local/bin/chef-client:19
>
>
>
> Here is the debug log
>
>
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: Loading plugin kernel
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -s STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: Linux
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -s STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -s STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG:
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -s STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: Ran (uname -s) returned 0
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -r STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: 2.6.32.1-rscloud
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -r STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -r STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG:
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -r STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: Ran (uname -r) returned 0
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -v STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: #15 SMP Mon Feb 22 13:22:15 UTC
>
> 2010
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -v STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -v STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG:
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -v STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: Ran (uname -v) returned 0
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -m STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: x86_64
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -m STDOUT ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- Begin uname -m STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG:
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: ---- End uname -m STDERR ----
>
> [Thu, 11 Mar 2010 18:09:45 +0000] DEBUG: Ran (uname -m) returned 0
>
>
>
> I am having the same exception when:
>
> - I invoke sudo chef-client from a non-root user (this is the same use
>
> case as trying remotely with ssh 'sudo chef-client'
>
> - the chef-client deamon runs every 30 minutes -> the deamon runs as
>
> root:root: (root 1218 0.0 0.9 92588 19360 ? S Mar10
>
> 0:00 /usr/local/bin/ruby /usr/bin/chef-client -d -c /etc/chef/client.rb -i
>
> 1800 -s 20 -L /var/log/chef/client.log)
>
>
>
> only running chef-client as root locally works.
>
>
>
> I have the same $PATH in both cases:
>
> - running as root
>
> - running as sudo (I have included /sbin, /usr/sbin, /usr/local/sbin)
>
>
>
> Any help appreciated at this point
>
>
>
> Thanks
>
>
>
> --Gilles
>
>
- --
>
Opscode, Inc
>
Joshua Timberman, Senior Solutions Engineer
>
C: 720.334.RUBY E:
>
>
>
-----BEGIN PGP SIGNATURE-----
>
Version: GnuPG v1.4.10 (Darwin)
>
>
iEUEARECAAYFAkuZPXMACgkQO97WSdVpzT0QkQCYwHgvaYZQt9JEu1sJceNSSeTU
>
BgCfQguUm3WMF3HnV0Au07pFSr3TYo0=
>
=lZiw
>
-----END PGP SIGNATURE-----
Archive powered by MHonArc 2.6.16.