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

Thanks,

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/-lncAVdmVX0J.
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.

Search Discussions

  • Jcbollinger at Jun 1, 2012 at 2:09 pm

    On Jun 1, 5:34 am, Rufus McDufus 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?

    What you wrote above looks like it ought to work. Perhaps Puppet is
    handling the "::pe_compliance::agent" inconsistently. Does it work if
    instead you write

    class pe_compliance::agent::cronmodify inherits pe_compliance::agent {
    [...]

    ?

    If it does, then I'm sure Puppetlabs would appreciate an official bug
    report. Given that Puppet accepts "inherits ::pe_compliance::agent"
    in the first place, it should recognize that it refers to the same
    class as "pe_compliance::agent", and therefore engage its machinery
    that allows super- and subclasses to both be declared on the same
    node.


    John

    --
    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.
  • Rufus McDufus at Jun 1, 2012 at 2:44 pm
    OK, I'm officially going crazy! I cut and paste the code I put in my first
    post - everything works perfectly now...

    I have done some pretty major code re-organisation so it's likely I may
    have fixed something along the way which caused spurious problems. I can't
    reproduce it any more :(

    Thanks for your help though!


    On Friday, 1 June 2012 15:09:15 UTC+1, jcbollinger wrote:


    On Jun 1, 5:34 am, Rufus McDufus 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?

    What you wrote above looks like it ought to work. Perhaps Puppet is
    handling the "::pe_compliance::agent" inconsistently. Does it work if
    instead you write

    class pe_compliance::agent::cronmodify inherits pe_compliance::agent {
    [...]

    ?

    If it does, then I'm sure Puppetlabs would appreciate an official bug
    report. Given that Puppet accepts "inherits ::pe_compliance::agent"
    in the first place, it should recognize that it refers to the same
    class as "pe_compliance::agent", and therefore engage its machinery
    that allows super- and subclasses to both be declared on the same
    node.


    John
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/y8DYTJXYdXcJ.
    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.
  • Rufus McDufus at Jun 1, 2012 at 3:12 pm
    Urr, I spoke too soon. It's working on some servers, not others. For
    instance on another I get:

    err: Could not retrieve catalog from remote server: 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 on node
    blah

    I've re-built the server to try and eliminate any catalog caching issues
    (not that I've ever seen any), no luck.

    On Friday, 1 June 2012 15:43:56 UTC+1, Rufus McDufus wrote:

    OK, I'm officially going crazy! I cut and paste the code I put in my first
    post - everything works perfectly now...

    I have done some pretty major code re-organisation so it's likely I may
    have fixed something along the way which caused spurious problems. I can't
    reproduce it any more :(

    Thanks for your help though!


    On Friday, 1 June 2012 15:09:15 UTC+1, jcbollinger wrote:


    On Jun 1, 5:34 am, Rufus McDufus 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?

    What you wrote above looks like it ought to work. Perhaps Puppet is
    handling the "::pe_compliance::agent" inconsistently. Does it work if
    instead you write

    class pe_compliance::agent::cronmodify inherits pe_compliance::agent {
    [...]

    ?

    If it does, then I'm sure Puppetlabs would appreciate an official bug
    report. Given that Puppet accepts "inherits ::pe_compliance::agent"
    in the first place, it should recognize that it refers to the same
    class as "pe_compliance::agent", and therefore engage its machinery
    that allows super- and subclasses to both be declared on the same
    node.


    John
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/95w1y2m3bAoJ.
    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.
  • Jcbollinger at Jun 1, 2012 at 4:43 pm

    On Jun 1, 10:12 am, Rufus McDufus wrote:
    Urr, I spoke too soon. It's working on some servers, not others. For
    instance on another I get:

    err: Could not retrieve catalog from remote server: 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 on node
    blah

    When you say it's working "on some servers" do you mean "on some
    puppetmasters" (as in, you have multiple masters) or do you mean "for
    some (Puppet) clients"?

    Either way, it appears to be an issue with the master, not with the
    agents. Did you try the modification I suggested?

    I've re-built the server to try and eliminate any catalog caching issues
    (not that I've ever seen any), no luck.

    Puppet does not cache failed catalogs, so caching could not explain
    the failures. Perhaps it could explain the successes, though.


    John

    --
    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.
  • Rufus McDufus at Jun 1, 2012 at 5:45 pm
    Hi John - apolologies, I meant it works on some clients and not others. I
    did try your suggestion.
    I've recently converted my site module to one with a lot more class
    inheritance so find I need to default to objects with fully-qualified
    namespace, but yes it still fails if the namespace isn't fully qualified.
    On Friday, 1 June 2012 17:43:18 UTC+1, jcbollinger wrote:


    On Jun 1, 10:12 am, Rufus McDufus wrote:
    Urr, I spoke too soon. It's working on some servers, not others. For
    instance on another I get:

    err: Could not retrieve catalog from remote server: 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 on node
    blah

    When you say it's working "on some servers" do you mean "on some
    puppetmasters" (as in, you have multiple masters) or do you mean "for
    some (Puppet) clients"?

    Either way, it appears to be an issue with the master, not with the
    agents. Did you try the modification I suggested?

    I've re-built the server to try and eliminate any catalog caching issues
    (not that I've ever seen any), no luck.

    Puppet does not cache failed catalogs, so caching could not explain
    the failures. Perhaps it could explain the successes, though.


    John
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/QwmBqirdujsJ.
    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.
  • Matthaus Litteken at Jun 1, 2012 at 7:11 pm
    Rufus,

    I've opened a ticket for your issue at
    https://projects.puppetlabs.com/issues/14781, where you can track its
    progress. Cron jobs generally shouldn't be producing output after a
    successful run, so thanks for bringing this up so it can get
    addressed.

    -matthaus

    On Fri, Jun 1, 2012 at 10:45 AM, Rufus McDufus wrote:
    Hi John - apolologies, I meant it works on some clients and not others. I
    did try your suggestion.
    I've recently converted my site module to one with a lot more class
    inheritance so find I need to default to objects with fully-qualified
    namespace, but yes it still fails if the namespace isn't fully qualified.

    On Friday, 1 June 2012 17:43:18 UTC+1, jcbollinger wrote:


    On Jun 1, 10:12 am, Rufus McDufus wrote:
    Urr, I spoke too soon. It's working on some servers, not others. For
    instance on another I get:

    err: Could not retrieve catalog from remote server: 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 on
    node
    blah

    When you say it's working "on some servers" do you mean "on some
    puppetmasters" (as in, you have multiple masters) or do you mean "for
    some (Puppet) clients"?

    Either way, it appears to be an issue with the master, not with the
    agents.  Did you try the modification I suggested?

    I've re-built the server to try and eliminate any catalog caching issues
    (not that I've ever seen any), no luck.

    Puppet does not cache failed catalogs, so caching could not explain
    the failures.  Perhaps it could explain the successes, though.


    John
    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/QwmBqirdujsJ.

    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.


    --
    Matthaus Litteken
    Release Manager, Puppet Labs

    --
    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.
  • Rufus McDufus at Jun 1, 2012 at 7:31 pm
    Thanks Matthaus - that's a great solution for me!

    Nan - I quite agree, but the strange thing is it's working perfectly on
    some nodes, not others and I can't figure any difference between them. I
    guess there must be - but where I don't know!


    Rob.
    On Friday, 1 June 2012 20:11:25 UTC+1, Matthaus Litteken wrote:

    Rufus,

    I've opened a ticket for your issue at
    https://projects.puppetlabs.com/issues/14781, where you can track its
    progress. Cron jobs generally shouldn't be producing output after a
    successful run, so thanks for bringing this up so it can get
    addressed.

    -matthaus

    On Fri, Jun 1, 2012 at 10:45 AM, Rufus McDufus <> wrote:
    Hi John - apolologies, I meant it works on some clients and not others. I
    did try your suggestion.
    I've recently converted my site module to one with a lot more class
    inheritance so find I need to default to objects with fully-qualified
    namespace, but yes it still fails if the namespace isn't fully
    qualified.
    On Friday, 1 June 2012 17:43:18 UTC+1, jcbollinger wrote:


    On Jun 1, 10:12 am, Rufus McDufus > wrote:
    Urr, I spoke too soon. It's working on some servers, not others. For
    instance on another I get:

    err: Could not retrieve catalog from remote server: 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
    on
    node
    blah

    When you say it's working "on some servers" do you mean "on some
    puppetmasters" (as in, you have multiple masters) or do you mean "for
    some (Puppet) clients"?

    Either way, it appears to be an issue with the master, not with the
    agents. Did you try the modification I suggested?

    I've re-built the server to try and eliminate any catalog caching
    issues
    (not that I've ever seen any), no luck.

    Puppet does not cache failed catalogs, so caching could not explain
    the failures. Perhaps it could explain the successes, though.


    John
    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/QwmBqirdujsJ.

    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.


    --
    Matthaus Litteken
    Release Manager, Puppet Labs
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/UlErH4IfFuYJ.
    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.
  • Nan Liu at Jun 1, 2012 at 6:27 pm

    On Fri, Jun 1, 2012 at 3:34 AM, Rufus McDufus 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+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 1, '12 at 10:34a
activeJun 1, '12 at 7:31p
posts9
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2021 Grokbase