[chef] Problem with user provider and passwords


Chronological Thread 
  • From: Albert Llop < >
  • To:
  • Subject: [chef] Problem with user provider and passwords
  • Date: Mon, 1 Feb 2010 11:52:51 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=Ewc/3XpOZDqpN3EyOtHVRAlGwiTBEQ2EcdlLJXASTAfsoOMlWdV9qnsBV/N2VE/3gT ZnXkqwQPiGLwvv903L7H7Ma2glJwTrzsSORCVgmRUuLglB7TAstMC3hyLCdo2FhSPRSp 871nq49xi0JNWoYqevPC+De9R5H6MtfHSGXm4=

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.

§