luke.bigum
2010-Sep-28 14:53 UTC
[Puppet Users] problem with overriding in two sub classes of the same parent class
Hi all, I''m working with class inheritance and run into a problem with a node including two child classes of the same parent class. The two child classes use the plusignment operator to append to the ''subscrube'' metaparm of the same resource in the parent class. The error is: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Parameter ''subscribe'' is already set on Service[httpd] by #<Puppet::Resource::Type:0x983e8f8> at /etc/puppet/manifests/site.pp: 16; cannot redefine at /etc/puppet/manifests/site.pp:24 on node test I kind of understand why it doesn''t work, but is there a way to achieve what I''m trying to do? I''ve tried playing with virtual resources for service[httpd] but I can''t get that to work either. This is the site.pp: #Master Puppet configuration file class httpd { service { "httpd": enable => true, ensure => true, hasrestart => true, hasstatus => true, } } class httpd::ssl inherits httpd { package { "mod_ssl": ensure => present, } Service["httpd"] { subscribe +> Package["mod_ssl"], } } class httpd::svn inherits httpd { package { "mod_dav_svn": ensure => present, } Service["httpd"] { subscribe +> Package["mod_dav_svn"], } } node test { include httpd::ssl include httpd::svn } -- 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.
Patrick
2010-Sep-28 22:36 UTC
Re: [Puppet Users] problem with overriding in two sub classes of the same parent class
On Sep 28, 2010, at 7:53 AM, luke.bigum wrote:> Hi all, > > I''m working with class inheritance and run into a problem with a node > including two child classes of the same parent class. The two child > classes use the plusignment operator to append to the ''subscrube'' > metaparm of the same resource in the parent class. > > The error is: > > err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Parameter ''subscribe'' is already set on Service[httpd] by > #<Puppet::Resource::Type:0x983e8f8> at /etc/puppet/manifests/site.pp: > 16; cannot redefine at /etc/puppet/manifests/site.pp:24 on node test > > I kind of understand why it doesn''t work, but is there a way to > achieve what I''m trying to do?If you are using this as an example and you want it to work in the general case, I don''t know how. If you''re asking how to make the example work, use notify instead of subscribe. -- 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.