On Nov 22, 2010, at 11:37 AM, Stefan Schulte wrote:

> On Mon, Nov 22, 2010 at 07:48:18AM +0000, Paul Nasrat wrote:
>> I think there is an augeas lens for /etc/services - see eg
>> 
>> http://projects.puppetlabs.com/projects/1/wiki/Puppet_Augeas#Adding+a+service+that+uses+both+TCP+and+UDP+to+/etc/services
>> 
>> So you possibly could write a define or something to do what you want there.
>> 
>> Paul
> 
> But I think that will mean, that I have to deploy augeas to all my
> machines. I was trying to avoid that. And I think that this file is
> worth it to be supported by puppet directly.
> 
> I just had another thought:
> * Use name and protocol as a combined key to identify an entry. (I have
>  to find out if parsedfile supports that directly or if I can fake that
>  by munging name). The result whould be that
>  port {'telnet':
>    number   => 22,
>    protocol => tcp,
>  }
>  will not override a telnet udp entry. But if I want to specify both
>  udp and tcp its really ugly:
>  port {'telnet_udp':
>    name     => 'telnet',
>    number   => 22
>    protocol => udp,
>  }
> * create two types and provider. tcpport and udport. You can now say
>  tcpport {'telnet': number => 22},
>  udpport {'telnet': number => 22},
>  But I dont know what happens if two different types want to handle the
>  same file. If both ports are absent I guess the tcpprovier will
>  override /etc/services with telnet 22/tcp and then udpport will
>  override /etc/services, thus telnet 22/tcp is absent again.

If you invert it, it works better:

port { '22/udp': label => 'telnet' }

Or something like that.

I was looking through some heinously old (pre-Puppet code) somewhere and this 
is how it was solved, and I realized that while it's a touch ugly and would 
tend toward duplication (e.g., the udp and tcp cases would be duplicate here), 
it does solve the problem, which is more than I could do previously.

However, the multiple primary key solution is definitely actually the right 
one, so if you can figure out how to make it work (directly CC'ing Markus in 
hopes he'll chime in) that's definitely the "best" option (where "best" takes 
no account of effort, just result).

-- 
Always read stuff that will make you look good if you die in the
middle of it.       -- P. J. O'Rourke
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199




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