Greetings Puppet Users,
I have a chuck of code I'd like to centralize - you know DRY.
I've looked into a custom function, but I'm uncertain how to get at
the the puppet resources inside of ruby.
Here is the verbatim copy of the chuck in a puppet manifest:
if defined(Service['apache2']) {
$services_to_notify = [
Service['apache2'],
]
}
else {
$services_to_notify = []
}
and here is some hand-wavy pseudocode:
function return_service_array_if_defined($service) {
if defined(Service[$service]) {
return [
Service[$service],
]
}
else {
return []
}
}
Any suggestions or ideas for implementation?
Thanks!
-m
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAOLfK3V6i82smoDO2kwOYJTiurqdD3O_bt%2BaR4RYUGMsqCPgSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.