[Puppet - Bug #16082] (Unreviewed) Puppet agent with --detailed-exitcodes returns exit code 2 even if errors are encountered applying the catalog.

6 views
Skip to first unread message

tic...@puppetlabs.com

unread,
Aug 22, 2012, 3:52:32 PM8/22/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, ste...@zipkid.eu, eric.b...@gmail.com
Issue #16082 has been reported by Eric Pratt.

Bug #16082: Puppet agent with --detailed-exitcodes returns exit code 2 even if errors are encountered applying the catalog.

  • Author: Eric Pratt
  • Status: Unreviewed
  • Priority: Normal
  • Assignee:
  • Category: usability
  • Target version:
  • Affected Puppet version: 2.6.4
  • Keywords:
  • Branch:

The command I run is:

/usr/bin/puppet agent --onetime --verbose --ignorecache --no-daemonize --no-usecacheonfailure --color=false --detailed-exitcodes

One of my execs executes a shell script which is returning a non-zero error code. The verbose output shows this:

err: /Stage[main]/Etp::Install/Etp::Deploy[discovery]/Exec[migrate-discovery-db]: Failed to call refresh: /usr/local/etp/bin/migrate_db.sh /home/etpdiscovery/conf /home/etpdiscovery/db /home/etpdiscovery/datagen disco.master.ben.xml returned 21 instead of one of [0] at /home/configmgr/puppet-trunk/etouchpoint-systems/src/main/puppet/modules/etp/manifests/deploy.pp:561

Because a lot of changes are being made when this error happens, I expect to see an exit code of ‘6’ but I get a ‘2’ every time. Even if no changes are made and this exec fails, I expect to see a ‘4’.


You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account

tic...@puppetlabs.com

unread,
Aug 22, 2012, 6:15:20 PM8/22/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, ste...@zipkid.eu, eric.b...@gmail.com, i...@ianbrandt.com
Issue #16082 has been updated by eric sorenson.
  • Status changed from Unreviewed to Needs More Information
  • Assignee set to Eric Pratt
  • Keywords set to errors

Eric could you please provide a small, reproducible test case? I was unable to repro:

[er...@glitch.local ~/Sandbox/puppet-undef/manifests]% puppet apply --detailed-exitcodes --verbose -e 'exec { "/usr/local/bin/foooo": }'
Info: Applying configuration version '1345673176'
Error: Could not find command '/usr/local/bin/foooo'
Error: /Stage[main]//Exec[/usr/local/bin/foooo]/returns: change from notrun to 0 failed: Could not find command '/usr/local/bin/foooo'
Finished catalog run in 0.02 seconds
[er...@glitch.local ~/Sandbox/puppet-undef/manifests]% echo $?
4
[er...@glitch.local ~/Sandbox/puppet-undef/manifests]% puppet apply --detailed-exitcodes --verbose -e 'exec { "/usr/local/bin/foooo": } file { "/Users/eric/wth": ensure => present }' 
Info: Applying configuration version '1345673460'
/Stage[main]//File[/Users/eric/wth]/ensure: created
Error: Could not find command '/usr/local/bin/foooo'
Error: /Stage[main]//Exec[/usr/local/bin/foooo]/returns: change from notrun to 0 failed: Could not find command '/usr/local/bin/foooo'
Finished catalog run in 0.03 seconds
[er...@glitch.local ~/Sandbox/puppet-undef/manifests]% echo $?
6

Are you really on 2.6.4? The above was on a git checkout of our 2.6.x branch which has advanced a bit since 2.6.4 but not sure if this is implicated.

  • Author: Eric Pratt
  • Status: Needs More Information
  • Priority: Normal
  • Assignee: Eric Pratt
  • Category: usability
  • Target version:
  • Affected Puppet version: 2.6.4
  • Keywords: errors
  • Branch:

tic...@puppetlabs.com

unread,
Oct 16, 2012, 5:50:22 PM10/16/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, stuart....@remphrey.net, ste...@zipkid.eu, andres.c...@intel.com, eric.b...@gmail.com, i...@ianbrandt.com
Issue #16082 has been updated by eric sorenson.
  • Parent task set to #17017
  • Author: Eric Pratt
  • Status: Needs More Information
  • Priority: Normal
  • Assignee: Eric Pratt
  • Category: usability
  • Target version:
  • Affected Puppet version: 2.6.4
  • Keywords: errors
  • Branch:

tic...@puppetlabs.com

unread,
Oct 18, 2012, 2:02:41 PM10/18/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, stuart....@remphrey.net, ste...@zipkid.eu, andres.c...@intel.com, eric.b...@gmail.com, i...@ianbrandt.com
Issue #16082 has been updated by eric sorenson.
  • Parent task deleted (#17017)
  • Author: Eric Pratt
  • Status: Needs More Information
  • Priority: Normal
  • Assignee: Eric Pratt
  • Category: usability
  • Target version:
  • Affected Puppet version: 2.6.4
  • Keywords: errors
  • Branch:

tic...@puppetlabs.com

unread,
Nov 5, 2012, 12:34:53 AM11/5/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, stuart....@remphrey.net, ste...@zipkid.eu, andres.c...@intel.com, eric.b...@gmail.com, i...@ianbrandt.com
Issue #16082 has been updated by Chris Price.

Eric S: I got bitten by this one this weekend as well. I can repro it in 2.7.x and 3.0.1. It’s causing me problems trying to write a custom type/provider, but you can repro it with built-in types using a manifest like this one:

notify { "hi": }

exec { "/bin/foo":
    refreshonly => true,
    subscribe   => Notify["hi"],
}

Then run that with puppet apply --detailed-exitcodes:

$ puppet apply --detailed-exitcodes ./foo2.pp 
No LSB modules are available.
No LSB modules are available.
hi
/Stage[main]//Notify[hi]/message: defined 'message' as 'hi'
Error: /Stage[main]//Exec[/bin/foo]: Failed to call refresh: Could not find command '/bin/foo'                                                                                        
Error: /Stage[main]//Exec[/bin/foo]: Could not find command '/bin/foo'
Finished catalog run in 0.15 seconds
$ echo $?
2
$ 

It definitely seems like the exit code there should be ‘4’ or ‘6’.

  • Author: Eric Pratt
  • Status: Needs More Information
  • Priority: Normal
  • Assignee: Eric Pratt
  • Category: usability
  • Target version:
  • Affected Puppet version: 2.6.4
  • Keywords: errors
  • Branch:

tic...@puppetlabs.com

unread,
Nov 5, 2012, 12:35:29 AM11/5/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, stuart....@remphrey.net, ste...@zipkid.eu, andres.c...@intel.com, eric.b...@gmail.com, eric.s...@puppetlabs.com, i...@ianbrandt.com
Issue #16082 has been updated by Chris Price.
  • Status changed from Needs More Information to Needs Decision
  • Assignee changed from Eric Pratt to eric sorenson
  • Author: Eric Pratt
  • Status: Needs Decision
  • Priority: Normal
  • Assignee: eric sorenson
  • Category: usability
  • Target version:
  • Affected Puppet version: 2.6.4
  • Keywords: errors
  • Branch:
Reply all
Reply to author
Forward
0 new messages