Issue #19411 has been updated by Michael Hrivnak.

If there is an error, the exit code should be non-zero regardless of the 
output. This is the POSIX way, and it presumably is a good model to follow 
here. A good starting place for info about exit code conventions: 
http://linux.die.net/man/3/exit

Also, I don't think an assumption should be made that the calling process will 
want to parse the output. A simple workflow would be to check the exit code, 
and if non-zero, stuff the JSON output in a database or similar for some other 
(more capable) mechanism to digest later. Following the POSIX "no news is good 
news" philosophy, the same calling process could reasonably throw away the 
output unless an error has been detected.

Lastly, I don't know of any documentation for what the serialized output should 
look like, so it would be tough to expect a calling process to depend on 
parsing that for determination of success/failure. I know what the convention 
is based on the evidence, but it isn't a guarantee until someone guarantees it. 
:) My apologies if this documentation does exist; I'd love to see it if so.

In sum, everyone and everything will understand that a non-zero exit code means 
an error occurred. Any other output should be supplemental.
----------------------------------------
Bug #19411: puppet module failures with JSON/YAML rendering have exit code 0
https://projects.puppetlabs.com/issues/19411#change-84013

Author: Dominic Cleal
Status: Needs Decision
Priority: Normal
Assignee: Andrew Parker
Category: Faces
Target version: 
Affected Puppet version: development
Keywords: 
Branch: 


When using puppet module with default console rendering, the exit code changes 
if there's a failure:

    $ puppet module install error/error >/dev/null 2>&1; echo $?
    1

However when running with JSON or YAML rendering, it isn't changed:

    $ puppet module --render-as json install error/error >/dev/null 2>&1; echo 
$?
    0


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

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to