[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5

Luke Kanies luke at madstop.com
Wed Apr 8 21:48:14 UTC 2009


The following commit has been merged in the master branch:
commit 682dd8b933c5feeed389b644b75f27e66e863276
Author: Luke Kanies <luke at madstop.com>
Date:   Sat Feb 14 11:55:20 2009 -0600

    Fixing password validation to support symbols.
    
    My fix for #1920 broke when you set :absent
    or :present.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 5603886..6b6ff82 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -145,7 +145,7 @@ module Puppet
             desc "The user's password, in whatever encrypted format the local machine requires. Be sure to enclose any value that includes a dollar sign ($) in single quotes (\')."
 
             validate do |value|
-                raise ArgumentError, "Passwords cannot include ':'" if value.include?(":")
+                raise ArgumentError, "Passwords cannot include ':'" if value.is_a?(String) and value.include?(":")
             end
 
             def change_to_s(currentvalue, newvalue)
diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb
index 15a3e25..dadcc65 100755
--- a/spec/unit/type/user.rb
+++ b/spec/unit/type/user.rb
@@ -40,10 +40,6 @@ describe user do
         it "should have a valid provider" do
             user.create(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider)
         end
-
-        it "should fail if a ':' is included in the password" do
-            lambda { user.create(:name => "foo", :password => 'some:thing') }.should raise_error(Puppet::Error)
-        end
     end
 
     properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :groups, :roles, :auths, :profiles, :project, :keys]
@@ -235,6 +231,14 @@ describe user do
         it "should not include the password in the change log when changing the password" do
             @password.change_to_s("other", "mypass").should_not be_include("mypass")
         end
+
+        it "should fail if a ':' is included in the password" do
+            lambda { @password.should = "some:thing" }.should raise_error(ArgumentError)
+        end
+
+        it "should allow the value to be set to :absent" do
+            lambda { @password.should = :absent }.should_not raise_error
+        end
     end
 
     describe "when manages_solaris_rbac is enabled" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list