On Mon, May 23, 2011 at 11:45 AM, Dan Bode <[email protected]> wrote:
> For types with composite namevars, hash2resource > should use namevar_join to populate tilte with > namevar. > > Signed-off-by: Dan Bode <[email protected]> > --- > Local-branch: issue/master/7629 > lib/puppet/type.rb | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb > index e62a764..305042d 100644 > --- a/lib/puppet/type.rb > +++ b/lib/puppet/type.rb > @@ -916,8 +916,11 @@ class Type > > title = hash.delete(:title) > title ||= hash[:name] > - title ||= hash[key_attributes.first] if key_attributes.length == 1 > - > + title ||= if key_attributes.length == 1 > + hash[key_attributes.first] > + else > + namevar_join(hash) > + end > - title = hash.delete(:title) - title ||= hash[:name] - title ||= if key_attributes.length == 1 - hash[key_attributes.first] - else - namevar_join(hash) - end + title = hash.delete(:title) || namevar_join(hash) > raise Puppet::Error, "Title or name must be provided" unless title > > # Now create our resource. > -- > 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.
