Rich Rauenzahn
2011-Jun-29 17:03 UTC
[Puppet Users] <<>> imports, defined(), and conflicts
We''re trying to write a rule that <<>> imports a bunch of
nagios
Nagios_host rules. But then we take a list of machines and add
Nagios_host rules for them as well. Some of the systems might
overlap, and we were hoping to use puppet to weed them out.
We assumed if we did
class a {
Nagios_host <<>>
Nagios_service <<>>
}
class b {
...
if ! defined Nagios_host[$a_host] {
nagios_host { $a_host: ...}
nagios_service { ... }
}
...
}
include a
include b
That we could count on using the defined() function to determine
whether something was already defined and define it if it isn''t.
This isn''t working -- we get a duplicate nagios_service entry, which
tells me either one of our hosts in registering a nagios_service,
without a nagios_host entry, or I can''t count at all on the evaluation
order of <<>>''s and resource definitions.
I just verified the node has a nagios_host defined. Is there any
other way around this problem? (I have some other ideas, like a
concat file with the hosts defined and the grep -v''ing them.. but was
hoping for something more elegant.)
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.