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"]
}

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

> 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(',') %>

-- 
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