Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-23 Thread markus
> Hm, does this work in case I have one keyattribute that is not "name" > (like the fileresource where the keyattribute is "path")? No, but neither does the existing code. :( > If not, here is a second suggestion > > def self.title_join(hash) > # extract all parameters that are keya

Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-23 Thread Stefan Schulte
On Sun, May 22, 2011 at 05:56:29PM -0700, Dan Bode wrote: > I just finished something very similar: > > > def self.title_join(hash) > "#{hash[:domain]}/#{hash[:type]}/#{hash[:item]}" > end > > where the default case was: > > + def self.title_join(hash) > +case key_attributes.length

Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-22 Thread markus
> I just finished something very similar: > > > def self.title_join(hash) > "#{hash[:domain]}/#{hash[:type]}/#{hash[:item]}" > end > > where the default case was: > > + def self.title_join(hash) > +case key_attributes.length > +when 0,1; hash[:name] > +else > + Puppet

Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-22 Thread Dan Bode
I just finished something very similar: def self.title_join(hash) "#{hash[:domain]}/#{hash[:type]}/#{hash[:item]}" end where the default case was: + def self.title_join(hash) +case key_attributes.length +when 0,1; hash[:name] +else + Puppet.warning('you should specify

Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-22 Thread markus
So what if we replaced this: 910 title = hash.delete(:title) 911 title ||= hash[:name] 912 title ||= hash[key_attributes.first] if key_attributes.length == 1 With something that took an array of arrays of strings and symbols and "reconstitutes" the title from the first one that matches: tit

Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-22 Thread Dan Bode
On Sun, May 22, 2011 at 4:42 PM, markus wrote: > > > It actually seems to get a little sticky for purging, below I am > > outlining how it works, I was just curious if anyone has spent time > > thinking about this use case before and how it should work: > > > > As far as I can tell, the title_pat

Re: [Puppet-dev] composite namevars (part 1) - purging

2011-05-22 Thread markus
> It actually seems to get a little sticky for purging, below I am > outlining how it works, I was just curious if anyone has spent time > thinking about this use case before and how it should work: > > As far as I can tell, the title_patterns can only map in one direction > title->parameters Th

[Puppet-dev] composite namevars (part 1) - purging

2011-05-22 Thread Dan Bode
Hi all, I have been working on getting composite namevars to work with parsedfile. It actually seems to get a little sticky for purging, below I am outlining how it works, I was just curious if anyone has spent time thinking about this use case before and how it should work: As far as I can tell