Ask Your Question
2

how to get a correct detailed exit code when using --noop ?

asked 2017-05-15 23:17:47 -0500

igortr gravatar image

Hi,

when running a "dry run" puppet-apply, I would like to get a detailed exit code corresponding to the changes puppet would have made, if running without --noop. i.e. if some change needs to be made - report it and return 2.

currently, it will report the changes, but always return 0 when in --noop.

there was a bug about it https://projects.puppetlabs.com/issue... but no resolution.

is there any work around to this?

P.S I am running apply as part of a much larger orchestration flow (involving shell and other orchestrators), and would really like to get a simple exit code of "what would have happened", to decide my next step. I'd like to avoid grepping logs if possible since log structure tends to change and isn't reliable.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-05-16 11:32:36 -0500

smarlow gravatar image

It looks like the relevant ticket here is PUP-686, and there hasn't been much movement on that.

Gareth appears to have worked around this with --lastrunfile and --postrun_command with this script. That might be a path that you could go down. Information on both of those parameters can be found here.

There's also the possibility of writing up a custom report processor to spit out information that is usable to you. It'd be a bit more robust than grepping logs, but it's also more work.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-05-15 23:01:36 -0500

Seen: 24 times

Last updated: May 16