Use more correct version of the password provider fix

Submitted by:	tdb (private email)
Feature safe:	yes
This commit is contained in:
Steve Wills 2011-11-13 13:18:28 +00:00
parent e310593f4a
commit 537e69f52f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=285699
2 changed files with 18 additions and 4 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= puppet
PORTVERSION= 2.7.6
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://downloads.puppetlabs.com/puppet/

View File

@ -1,5 +1,3 @@
diff --git lib/puppet/provider/user/pw.rb lib/puppet/provider/user/pw.rb
index a5988ca..c2fff37 100644
--- lib/puppet/provider/user/pw.rb
+++ lib/puppet/provider/user/pw.rb
@@ -1,10 +1,11 @@
@ -15,11 +13,27 @@ index a5988ca..c2fff37 100644
defaultfor :operatingsystem => :freebsd
@@ -37,5 +38,24 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
@@ -23,7 +24,7 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
def addcmd
cmd = [command(:pw), "useradd", @resource[:name]]
@resource.class.validproperties.each do |property|
- next if property == :ensure
+ next if property == :ensure or property == :password
# the value needs to be quoted, mostly because -c might
# have spaces in it
if value = @resource.should(property) and value != ""
@@ -37,5 +38,30 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
cmd
end
+
+ def create
+ super
+
+ # Set the password after create if given
+ self.password = @resource[:password] if @resource[:password]
+ end
+
+ # use pw to update password hash
+ def password=(cryptopw)
+ Puppet.debug "change password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
@ -37,6 +51,5 @@ index a5988ca..c2fff37 100644
+ Puppet.debug "finished password for user '#{@resource[:name]}' method called : '#{current_password}'"
+ current_password
+ end
+
end