Issue #19411 has been updated by Charlie Sharpsteen.

Dominic Cleal wrote:
> I'm unsure how standard the JSON output is, or if it's specific to the module 
> face, which could be an issue if trying to make this generic.  Would other 
> faces follow the same object format with `result` and `error` available?

Just about any face can be coerced to use a specific renderer. For example:

    puppet help module --render-as json

Even though that produces horribly malformed output the idea is that any face 
is by default capable of attempting to deliver output in any format. When the 
default renderer for a format falls over as in the example above, 
`when_rendering` blocks can be used.
  

Michael Hrivnak wrote:
> In sum, everyone and everything will understand that a non-zero exit code 
> means an error occurred. Any other output should be supplemental.

I looked into the design of Faces and one aspect is that the command line is 
just one way that these actions were designed to be accessed. The line of 
thinking that led me to hypothesize this might be an intentional design choice 
is that formats such as JSON or YAML may be intended for delivery through a web 
service or other method where POSIX exit codes are not available to the calling 
process. In comparison, rendering to a console is a case where the caller is 
guaranteed to have access to the exit code.

But, like I said in my last update, I'm trying to guess the intentions of the 
code at this point so the question will have to be settled by someone who knows 
the design.
----------------------------------------
Bug #19411: puppet module failures with JSON/YAML rendering have exit code 0
https://projects.puppetlabs.com/issues/19411#change-84018

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