Hi,
I wanted to write a resourcetype to manage ports in /etc/services. I did
write a type where you can do something like:
port { 'telnet',
protocol => 'tcp',
number => '22',
port_aliases => ['alias1','alias2'],
}
This is totally sufficient for ME (I'm realising entries that just use
tcp, so name is uniq in my case)
But now I noticed that there already is a resource type in puppet but
it is commented out for 4 years now. When I looked at it, it made
me think, because most ports have tcp and udp entries.
When I have two lines
telnet 22/udp
telnet 22/tcp
I think puppet will change the first entry to tcp before noticing that
there already is the desired entry in our file.
But it's really hard to decide how a port type/provider should actually
handle these duplicate entries. Imagine we just have the following
entry:
myport 22/udp
If the user defines a port called 'myport' with the protocol 'tcp', how
whould I know if the user wants udp replaced with tcp or just wants to
have a second entry for myport?
The type Luke wrote (I guess its not working because its commented out)
tries to join lines with different protocols and builds a protocol-array,
so you can do:
port { 'telnet':
protocol => ['tcp','udp' ],
number => 22,
}
Ok looks like a good idea (but really hackish to implement with
parsedfile), but how should we merge these two lines:
myport 22/udp myport_udp
myport 22/tcp myport_tcp
port { 'myport':
number => '22'
protocol => ['tcp','udp']
port_aliases => ???
}
I'm really interested in how you whould write a port type/provider.
-Stefan
pgppLtcSBslhL.pgp
Description: PGP signature
