On Fri, Jun 1, 2012 at 3:34 AM, Rufus McDufus <r...@bamalam.com> wrote: > Hi folks - I'm trying what should be a simple task but I'm having a case of > brain fade! In puppet enterprise in the pe_compliance module, a cronjob > gets added by class pe_compliance::agent: > > % cat /opt/puppet/share/puppet/modules/pe_compliance/manifests/agent.pp > class pe_compliance::agent { > cron { 'report_baseline': > command => > 'PATH=/opt/puppet/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin > /opt/puppet/bin/puppet inspect', > hour => '20', > minute => '0', > } > } > > I want to modify this cronjob to redirect stdout to /dev/null but I don't > want to edit this file directly as I don't want to modify core modules. > Everything I try to try and override results in a duplicate definition of > Pe_compliance::agent or 'Only subclasses can override parameters'. For > instance if I try: > > class pe_compliance::agent::cronmodify inherits ::pe_compliance::agent { > Cron['report_baseline'] { > command => > 'PATH=/opt/puppet/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin > /opt/puppet/bin/puppet inspect >/dev/null' > } > } > include pe_compliance::agent::cronmodify > > I get: > Error 400 on SERVER: Duplicate declaration: Class[Pe_compliance::Agent] is > already declared; cannot redeclare at > /opt/puppet/share/puppet/modules/pe_compliance/manifests/init.pp:15 > > > Is there an easy way of overriding this parameter?
You can't override this using inheritance because the class already been declared in init.pp: class { "pe_compliance::agent": require => Anchor['pe_compliance::begin'], before => Anchor['pe_compliance::end'], } I don't know the reason why parametrized class was used because there's really no variables in the agent. One of things you can try is to replace the module with your own since it's really just one resource since I don't see any other pe-* module depending on it at the moment. If there is dependency I missed, you can try copying the existing module from /opt/puppet/share/puppet/modules/pe_compliance to /etc/puppetlabs/puppet/modules/pe_compliance and customize the copy in /etc/puppetlabs/modules. Thanks, Nan -- 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.