Eugene Vilensky
2013-Mar-01 16:18 UTC
[Puppet Users] troubleshooting missing facts when run as service?
Hello, Hello, RHEL6 x86_64, Puppet master 2.7.18, clients 2.7.19. One of my nodes reports: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Package[undef] is already declared in file /etc/puppet/modules/initial_config/manifests/basic_packages.pp at line 22; cannot redeclare at /etc/puppet/modules/authconfig/manifests/init.pp:7 on node wp-prd.library.northwestern.edu However, this only happens when Puppet runs as a service, "puppet agent --test" runs complete fine. Packages are specified on a case statement with a trivial custom fact for major RH release[1] My guess that during a run as a service, that fact isn''t processed, but during a "puppet agent --test" it is. Any tips on how I might troubleshoot this discrepancy? Thank you! --- [1] class authconfig::params { case $::osfamily { ''RedHat'': { case $::operatingsystemmajorversion { ''6'': { $authpackages = [''sudo'',''authconfig'',''krb5-workstation'', ''samba-winbind'', ''pam_krb5''] $username = '''' $passwd = '''' file { "/etc/pam.d/sshd": ensure => present, owner => ''root'', group => ''root'', content => template("authconfig/pam.d/sshd.erb"), } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Mar-04 14:27 UTC
[Puppet Users] Re: troubleshooting missing facts when run as service?
On Friday, March 1, 2013 10:18:46 AM UTC-6, Trammael wrote:> > > RHEL6 x86_64, Puppet master 2.7.18, clients 2.7.19. > > One of my nodes reports: > > Could not retrieve catalog from remote server: Error 400 on SERVER: > Duplicate declaration: Package[undef] is already declared in file > /etc/puppet/modules/initial_config/manifests/basic_packages.pp at line 22; > cannot redeclare at /etc/puppet/modules/authconfig/manifests/init.pp:7 on > node wp-prd.library.northwestern.edu > > However, this only happens when Puppet runs as a service, "puppet agent > --test" runs complete fine. > > Packages are specified on a case statement with a trivial custom fact for > major RH release[1] > > My guess that during a run as a service, that fact isn''t processed, but > during a "puppet agent --test" it is. Any tips on how I might troubleshoot > this discrepancy? >You have at least two packages, declared in different modules, whose names are not being set as you intend. The error message tells you [two of] the manifests involved, and you would do well to look at the Package declarations in those manifests. The problematic declarations probably have this form: package { $some_module::some_class::some_var: # maybe some parameters } You should also ensure that all ''case'' statements such as the two in the manifest fragment you presented have ''default'' clauses that catch unexpected circumstances and signal you. For instance, they could execute the fail() function to trigger a parse error with a message describing what the unexpected fact value was. Do not let unhandled cases fall through unless you intend to do so. (And where you do intend to do so, be sure to document it for yourself.) John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.