On Mon, May 23, 2011 at 11:45 AM, Dan Bode <[email protected]> wrote:

> - for composite namevars to support purging
>  and 'puppet resource' quiery all, it needs to
>  be possible to map from the composite namevars
>  to a single id.
>
> - the basic idea is that authors of types need to
>  implement this method if they want to support
>  query all or purging.
>
> Signed-off-by: Dan Bode <[email protected]>
> ---
> Local-branch: issue/master/7629
>  lib/puppet/type.rb |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
> index 1dbf124..dc4764e 100644
> --- a/lib/puppet/type.rb
> +++ b/lib/puppet/type.rb
> @@ -219,6 +219,14 @@ class Type
>     end
>   end
>
> +  def self.namevar_join(hash)
> +    case key_attributes.length
> +    when 0,1; hash[:name]
>

replaced with:

     case key_attributes.length
-    when 0,1; hash[:name]
+    when 0; hash[:name]
+    when 1; hash[key_attributes.first]
     else



> +    else
> +      Puppet.warning('you should specify a joiner when there are two of
> more key attributes')
> +    end
> +  end
> +
>   def uniqueness_key
>     self.class.key_attributes.sort_by { |attribute_name|
> attribute_name.to_s }.map{ |attribute_name| self[attribute_name] }
>   end
> --
> 1.6.5.1
>
> --
> 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.
>
>

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