[chef] Re: Re: Problem with user provider and passwords


Chronological Thread 
  • From: Albert Llop < >
  • To:
  • Subject: [chef] Re: Re: Problem with user provider and passwords
  • Date: Mon, 1 Feb 2010 15:12:01 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=TJ1RhMuS4WoA4QBGyr2DvCrU9yxo7GoLJWiaq5B5d7K809niSpwQ1bxnNrxfiP65dC 26SuipKVGwMtc+7Eo82KKBi+8bAkaTfIsJkx6f36HsNmzqQXAC/fZH6nkf/GzNIL+qfk LqA/OoC4GEaunqG6AGwm0Fh8jy1ZVFnnwVWig=

Muchas gracias Joshua!

this worked nicely. I'm still wondering how could it work in the first place so many months ago.

Cheers
--
Albert Llop
Tech Department
" target="_blank">


On 1 February 2010 12:09, Joshua Sierles < " target="_blank"> > wrote:
Albert,

It's not the 'shadow' gem you need - it's the C extension named 'libshadow-ruby'. This is available as a package on most system Ruby installations. If you use REE, you might want to try running this cookbook with chef-solo beforehand:


Alternatively you can manually install the library in the 'files' directory in the cookbook (I can never find the original download location for this thing).

- Joshua

On Feb 1, 2010, at 11:52 AM, Albert Llop wrote:

Hello there,
we want to change the password of the only user created in all of our chef clients (well, the user we use to log in through ssh). In our recipe we have this:

package "libshadow-ruby1.8"

user "kom" do
  comment "Kings of Mambo user"
  gid "users"
  uid 1000
  home "/home/kom"
  supports :manage_home => true
  shell "/bin/bash"
  password "<snip>"
  not_if "grep 'kom:<snip> /etc/shadow"
end

This worked for some time, and I just can't understand what happened, because it doesn't anymore. I changed the <snip>'d part to have a new password, uploaded to the chef-server, and executed chef-client on a client. this is the log (yes, we're still on 0.7.4, hope that's ok :p, been working flawlessly and didn't have the time to worry about upgrades):

[Mon, 01 Feb 2010 11:44:26 +0100] ERROR: user[kom] (/srv/chef/cache/cookbooks/basics/recipes/user.rb line 6) had an error:
uninitialized constant Shadow::Passwd
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in `const_missing'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/provider/user.rb:73:in `load_current_resource'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:55:in `build_provider'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:86:in `converge'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:85:in `each'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:85:in `converge'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/resource_collection.rb:58:in `each'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/resource_collection.rb:57:in `each'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:63:in `converge'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/client.rb:373:in `converge'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/client.rb:81:in `run'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/client.rb:164:in `run_application'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/client.rb:162:in `loop'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/client.rb:162:in `run_application'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application.rb:57:in `run'/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/bin/chef-client:26/usr/bin/chef-client:19:in `load'/usr/bin/chef-client:19
[Mon, 01 Feb 2010 11:44:26 +0100] ERROR: NameError
[Mon, 01 Feb 2010 11:44:26 +0100] FATAL: uninitialized constant Shadow::Passwd
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in `const_missing'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/provider/user.rb:73:in `load_current_resource'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:55:in `build_provider'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:86:in `converge'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:85:in `each'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:85:in `converge'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/resource_collection.rb:58:in `each'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/resource_collection.rb:57:in `each'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/runner.rb:63:in `converge'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/client.rb:373:in `converge'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/client.rb:81:in `run'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/client.rb:164:in `run_application'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/client.rb:162:in `loop'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application/client.rb:162:in `run_application'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/lib/chef/application.rb:57:in `run'
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/chef-0.7.4/bin/chef-client:26
/usr/bin/chef-client:19:in `load'
/usr/bin/chef-client:19

 In the highlighted file, there's this line:

              shadow_info = Shadow::Passwd.getspnam(@new_resource.username)


A couple of lines before there's a require 'shadow'. I installed the shadow gem (sudo gem install shadow), but nothing changed, and I don't think that was the desired action anyway since the Shadow gem is an ActiveRecord restful server.

The package libshadow-ruby1.8 is already installed (from day 1 of the installation)

# apt-get install libshadow-ruby1.8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libshadow-ruby1.8 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

I'm out of ideas. Can't find that Shadow::Passwd anywhere. I can change passwords everywhere manually, but would rather spend the time trying to fix this. Any idea/tip/help is most welcome. 

Thanks!!
--
Albert Llop





Archive powered by MHonArc 2.6.16.

§