On 14/01/14 23:27, jcbollinger wrote:
On Tuesday, January 14, 2014 5:42:54 AM UTC-6, Jonathan Gazeley wrote:
This is ridiculous and bizarre behaviour and seems to defy the
whole point of having a managed resource, and there is an old,
open bug for it.
http://projects.puppetlabs.com/issues/4020
<http://projects.puppetlabs.com/issues/4020>
I think "ridiculous and bizarre" is a bit strong. It's strange that
the type selects one element and ignores the rest, but it's not so
surprising that's what's wanted in the first place is whatever string
is supposed to be plugged in to the corresponding hole in the Nagios
config file. That's even a viable way to read the documentation for
the type. And I certainly don't understand what any of this has to do
with "the whole point of having a managed resource".
John,
I'm sorry for my outburst yesterday - quite embarrassed to read my
message back again :\ I was just a bit frustrated to run into bugs
and/or unexpected behaviour when I also had some of our dev/ops guys on
my back wondering when I was going to fix their monitoring notifications.
"Hulk smash, Hulk do Nagios configs!"
I think what I meant was - data structures within Puppet and Hiera are
almost always handled as arrays or hashes, and when you call upon other
classes and resources you would tend to pass it an array or a hash. I
was surprised that this isn't the case for nagios_* types, which expect
a comma-delimited format.
There's a workaround using templates as a filthy hack:
# manifest.pp
nagios_host { "$fqdn":
address => "$ipaddress",
hostgroups => template("join_hostgroups.erb")
}
You seem angry about this. I don't understand why.
Yeah, today I'm not sure why either. I guess it seems a less elegant
solution (and potentially more expensive in terms of resources on an
already busy puppetmaster). It's the first time I've had to do something
like this (I guess that makes me lucky).
Anyway, if you have Puppetlabs's "stdlib" add-in module installed,
then it provides a join() function that can replace the template. Or
at minimum it would probably be better to use an inline_template()
instead of an external one.
After my email yesterday, I changed my approach to use an
inline_template() which works nicely. Also good to know that there's a
join() function for for joining arrays - thanks for the tip. We do
already have "stdlib" installed, but only as a dependency for other
forge modules - I've never called upon its functions myself. Thanks for
the tip - I'll check it out tomorrow (now after 4pm here and we're not
allowed to make changes in case we break stuff!)
Sorry again for my rage, and thanks for your advice. If you're ever in
Bristol (UK), I'll buy you a pint :)
Cheers,
Jonathan
--
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/52D6B40C.5080909%40bristol.ac.uk.
For more options, visit https://groups.google.com/groups/opt_out.