[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
James Turnbull
james at lovedthanlost.net
Fri Jan 23 14:21:50 UTC 2009
The following commit has been merged in the master branch:
commit 047e5d073c2362da95553c1778b9eb5176b0c05b
Author: Andrew Shafer <andrew at reductivelabs.com>
Date: Thu Nov 27 03:09:03 2008 -0700
Handle password when user is created
strip out the -p and call password= after the thing is done
diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb
index f7ae066..65bd639 100644
--- a/lib/puppet/provider/user/user_role_add.rb
+++ b/lib/puppet/provider/user/user_role_add.rb
@@ -28,7 +28,8 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd do
def add_properties
cmd = []
Puppet::Type.type(:user).validproperties.each do |property|
- next if property == :ensure
+ #skip the password because we can't create it with the solaris useradd
+ next if property == :ensure || property == :password
# the value needs to be quoted, mostly because -c might
# have spaces in it
if value = @resource.should(property) and value != ""
@@ -83,6 +84,10 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd do
else
run(addcmd, "create")
end
+ # added to handle case when password is specified
+ if @resource[:password]
+ self.password = @resource[:password]
+ end
end
def destroy
diff --git a/spec/unit/provider/user/user_role_add.rb b/spec/unit/provider/user/user_role_add.rb
index ccbda1f..49359eb 100644
--- a/spec/unit/provider/user/user_role_add.rb
+++ b/spec/unit/provider/user/user_role_add.rb
@@ -49,6 +49,10 @@ describe provider_class do
end
describe "when calling create" do
+ before do
+ @provider.stubs(:password=)
+ end
+
it "should use the add command when the user is not a role" do
@provider.stubs(:is_role?).returns(false)
@provider.expects(:addcmd).returns("useradd")
@@ -107,6 +111,7 @@ describe provider_class do
end
it "should add -o when the user is being created" do
+ @provider.stubs(:password=)
@provider.create
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list