On Tue, Oct 12, 2010 at 12:15 PM, Jesse A Wolfe <[email protected]> wrote:

> +1
>
>
> On Mon, Oct 11, 2010 at 9:42 PM, Markus Roberts <[email protected]>wrote:
>
>> This fixes the command / option issues of #4963 as suggested on the
>> ticket; the
>> setting-expiry when not needed aspects are deferred to #4975.
>>
>> Signed-off-by: Markus Roberts <[email protected]>
>> ---
>>  lib/puppet/provider/user/user_role_add.rb     |    6 +++---
>>  spec/unit/provider/user/user_role_add_spec.rb |    4 ++--
>>  2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/puppet/provider/user/user_role_add.rb
>> b/lib/puppet/provider/user/user_role_add.rb
>> index 7e7ad78..c8be75a 100644
>> --- a/lib/puppet/provider/user/user_role_add.rb
>> +++ b/lib/puppet/provider/user/user_role_add.rb
>> @@ -6,15 +6,15 @@ Puppet::Type.type(:user).provide :user_role_add, :parent
>> => :useradd, :source =>
>>
>>   defaultfor :operatingsystem => :solaris
>>
>> -  commands :add => "useradd", :delete => "userdel", :modify => "usermod",
>> :password => "chage", :role_add => "roleadd", :role_delete => "roledel",
>> :role_modify => "rolemod"
>> +  commands :add => "useradd", :delete => "userdel", :modify => "usermod",
>> :password => "passwd", :role_add => "roleadd", :role_delete => "roledel",
>> :role_modify => "rolemod"
>>   options :home, :flag => "-d", :method => :dir
>>   options :comment, :method => :gecos
>>   options :groups, :flag => "-G"
>>   options :roles, :flag => "-R"
>>   options :auths, :flag => "-A"
>>   options :profiles, :flag => "-P"
>> -  options :password_min_age, :flag => "-m"
>> -  options :password_max_age, :flag => "-M"
>> +  options :password_min_age, :flag => "-n"
>> +  options :password_max_age, :flag => "-x"
>>
>>   verify :gid, "GID must be an integer" do |value|
>>     value.is_a? Integer
>> diff --git a/spec/unit/provider/user/user_role_add_spec.rb
>> b/spec/unit/provider/user/user_role_add_spec.rb
>> index b3244f1..cc4fd9a 100644
>> --- a/spec/unit/provider/user/user_role_add_spec.rb
>> +++ b/spec/unit/provider/user/user_role_add_spec.rb
>> @@ -67,12 +67,12 @@ describe provider_class do
>>       @provider.create
>>     end
>>
>> -    it "should set password age rules" do
>> +    it "should set password age rules with passwd" do
>>       @resource = Puppet::Type.type(:user).new :name => "myuser",
>> :password_min_age => 5, :password_max_age => 10, :provider => :user_role_add
>>       @provider = provider_class.new(@resource)
>>       @provider.stubs(:user_attributes)
>>       @provider.stubs(:execute)
>> -      @provider.expects(:execute).with { |cmd, *args| args == ["-m", 5,
>> "-M", 10, "myuser"] }
>> +      @provider.expects(:execute).with { |args| args ==
>> ["/usr/bin/passwd","-n", 5, "-x", 10, "myuser"] }
>>       @provider.create
>>     end
>>   end
>> --
>> 1.7.0.4
>>
>>
+1 to the fix, but not the spec change. Because providers validate the
existence of their commands, this spec will now fail on any system which
doesn't have a /usr/bin/passwd command. It will return "nil" for the command
name, which is why the previous version of the spec was only checking the
arguments. I suppose a possibility is to confine the spec to Solaris, which
gives some validation that the command is correct for that system.

--
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Developers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<puppet-dev%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-dev?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<puppet-dev%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to