Bug #903

exec type logoutput doesn't work if command failed

Added by hrvojehr - over 4 years ago. Updated over 4 years ago.

Status:Closed Start date:
Priority:High Due date:
Assignee:Puppet Community % Done:

0%

Category:-
Target version:0.24.0
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

logoutput doesn’t work in exec type if command failed. Logging only works if command is successful.

Could be done: extending logoutput with a value “only_on_failure”.

Patch is quick fix. Basicly I just moved logging code before self.fail. This is quick patch because problem is now error output from command is displayed before message that command failed.

exec.patch (888 Bytes) hrvojehr -, 11/14/2007 10:24 pm

History

Updated by David Schmitt over 4 years ago

I applied this patch in my repository and added a few tests for the exec type.

This is in the rest/fix-903 branch of my repo at git://git.black.co.at/puppet-bugfixes:

commit 4afbaa6f7042eb1cccc8938ee1ccb53c662ba41c
Author: David Schmitt 
Date:   Sat Nov 17 11:40:15 2007 +0100

    fix #903: add patch from hrvojehr

    this moves logging of the command in front of failing from unexpected
    return. This helps very much to debug exec failures.

    Additionally I removed the unused local variable "loglevel"

commit 32d9afce4dd732d49a3157ce05f47d6f468569b3
Author: David Schmitt 
Date:   Sat Nov 17 11:37:06 2007 +0100

    tests for #903: fail when no logoutput is generated on failure

Updated by David Schmitt over 4 years ago

On top of this, I implemented

logoutput => on_failure
. I had some troubles implementing the should raise_error stuff in the tests, but the (puppet) functionality is there and tested.

commit 1b78f57284a37e86db2351c34a2bbf22c43f0275
Author: David Schmitt 
Date:   Mon Nov 19 10:21:56 2007 +0100

    Add Exec{ logoutput=> on_failure }

    This option only writes the output of the command to the log if the command
    failed.

Updated by Luke Kanies over 4 years ago

  • Status changed from 1 to Closed
  • 7 set to fixed

Applied David’s patches.

Also available in: Atom PDF