On 14/06/10 07:30 PM, donavan wrote:
> On Jun 12, 1:09 pm, Gabriel Filion <lelu...@gmail.com> wrote:
>> I tested giving a list of strings to the "hostgroups" attribute to the
>> nagios_host resource but it only considers the first element of the list.
>
> Something like this?:
> nagios_host {
>  "$fqdn":
>   address => "$ipaddress",
>   hostgroups => ["group1", "group2"]
> }
>

That's exactly what I'd like to do. Trying this generates a host config
for nagios with only "group1" in the "hostgroups" line.

> I haven't tried what youre doing, but sounds like it might be a Type/
> Provider bug.
>

bug or missing feature.. I haven't tried it with 0.25.5, though. I'm on
Debian unstable, using the puppet/puppetmaster packages, so the version
is 0.25.4

should I open a bug report about this?

>> Is there a way to "collect" unique group names for a single host and to
>> concatenate the final result in a comma separated string? The purpose of
>> this would be to make modules add nagios groups to the hosts if they
>> have those services installed.
>
> You might be able to use a template or function to join() your array.
>
> class bar{
>   $nagios_hostgroups += ["group1"]
> }
>
> class foo {
>  include bar
>  $nagios_hostgroups += ["group2"]
>  nagios_host {
>   "$fqdn":
>    address => "$ipaddress",
>    hostgroups => template("join_hostgroups.erb")
>  }
> }
>
> join_host_groups.erb:
> <%= nagios_hostgroups.join(',') %>
>

Interesting. I'll try this out in the next few days and give you
feedback on whether this workaround does the job.

-- 
Gabriel Filion

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to