Hi,

After some reading and experimenting, I thought I had found the solution
to the problem below in class inheritance, but again... I'm stuck.

As said, I have class "nagios-target", defined as listed below.

I now have this:

  class mta inherits nagios-target {

      Nagios_host [$hostname] {
          hostgroups +> "mail-satellite-servers",
      }
  }

This works; I get a Nagios host definition with the expected 'hostgroups'
setting.

Now I add a second class:

  class snmp inherits nagios-target {

      Nagios_host [$hostname] {
          hostgroups +> "snmp-servers",
      }
  }

but now I get:

Error 400 on SERVER: Parameter 'hostgroups' is already set on
Nagios_host[martijn] at /etc/puppet/manifests/classes/mta.pp:43; cannot
redefine at /etc/puppet/manifests/classes/snmp.pp:4 on node martijn.

What part of overriding parameters and the '+>' operator am I missing here?

Best regards,
Martijn.







On 02-03-11 15:55, Martijn Grendelman wrote:
> On 02-03-11 14:49, Brian Gallew wrote:
>> Sadly, signs point to "no".
> 
> Too bad. But since I run a patched Puppetmaster anyway, I can do what I
> want :-)
> 
> Unfortunately, it doesn't solve my problem.
> 
> I am trying to do the same thing as Gabriel Filion in this post:
> http://groups.google.com/group/puppet-users/browse_thread/thread/276e6e694520224d
> 
> So, I have a nagios-target class, that defines a virtual resource:
> 
>     @@nagios_host { "$hostname":
>         use => "generic-host",
>         address => $fqdn,
>         alias => $hostname,
>         ensure => present,
>         hostgroups => [],
>     }
> 
> and I would like to do something along the lines of this: in a different
> class (not a subclass of nagios-target), for example in the class that
> configures the MTA:
> 
>     Nagios_host [$hostname] {
>         hostgroups +> "mail-satellite-servers",
>     }
> 
> which results in this error:
> 
> "Only subclasses can override parameters at ..."
> 
> which sounds logical, but...
> 
> Is there any way to do what I want? I can't really think of anything,
> since (variable) scoping will always be in my way, as far as I can see...
> 
> Best regards,
> Martijn.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>>
>> On Wed, Mar 2, 2011 at 5:15 AM, Martijn Grendelman <mart...@iphion.nl
>> <mailto:mart...@iphion.nl>> wrote:
>>
>>     Hi,
>>
>>     A question for the devs. Will this:
>>
>>     http://projects.puppetlabs.com/issues/4020
>>
>>     make it into a release any time soon?
>>
>>     Best regards,
>>     Martijn.
>>
>>     --
>>     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
>>     <mailto:puppet-users@googlegroups.com>.
>>     To unsubscribe from this group, send email to
>>     puppet-users+unsubscr...@googlegroups.com
>>     <mailto:puppet-users%2bunsubscr...@googlegroups.com>.
>>     For more options, visit this group at
>>     http://groups.google.com/group/puppet-users?hl=en.
>>
>>
>> -- 
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
> 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to