+1

On May 4, 2009, at 11:01 AM, Francois Deppierraz wrote:

>
> "user doesn't exit" error appeared once again after the changes  
> which were
> applied in order to fix #2004.
>
> Validation must only check attributes presence, not their value.
>
> Signed-off-by: Francois Deppierraz <[email protected]>
> ---
> lib/puppet/type/ssh_authorized_key.rb |   20 ++++++++++++++------
> 1 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ 
> ssh_authorized_key.rb
> index 997afb8..33ed1d6 100644
> --- a/lib/puppet/type/ssh_authorized_key.rb
> +++ b/lib/puppet/type/ssh_authorized_key.rb
> @@ -39,11 +39,14 @@ module Puppet
>                     return super
>                 end
>
> -                if user = resource[:user]
> +                return nil unless user = resource[:user]
> +
> +                begin
>                     return File.expand_path("~%s/.ssh/ 
> authorized_keys" % user)
> +                rescue
> +                    Puppet.debug "The required user is not yet  
> present on the system"
> +                    return nil
>                 end
> -
> -                return nil
>             end
>         end
>
> @@ -77,9 +80,14 @@ module Puppet
>         end
>
>         validate do
> -            unless should(:target) or should(:user)
> -                raise Puppet::Error, "Attribute 'user' or 'target'  
> is mandatory"
> -            end
> +            # Go ahead if target attribute is defined
> +            return if @parameters[:target].shouldorig[0] != :absent
> +
> +            # Go ahead if user attribute is defined
> +            return if @parameters.include?(:user)
> +
> +            # If neither target nor user is defined, this is an error
> +            raise Puppet::Error, "Attribute 'user' or 'target' is  
> mandatory"
>         end
>     end
> end
> -- 
> 1.6.0.4
>
>
> >


-- 
The intelligent man finds almost everything ridiculous, the sensible
man hardly anything. -- Johann Wolfgang von Goethe
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
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