Ask Your Question
0

Why is all puppet output formatted as a shell error?

asked 2014-04-16 09:05:52 -0500

steadyonabix gravatar image

updated 2014-04-16 09:09:41 -0500

Is there a reason why Puppet adopts the same format as shell error messages for every line of output?

It means that when scripting tools I have to implement special handling for Puppet output to avoid false positives for shell errors....

Is there any reason for adopting this format?

e.g - Puppet

info: Applying configuration version '1397604843'

notice: //base::rsync_puppet/Exec[rsync current environment]/returns: executed successfully

Shell

[brad@localhost muse]$ runcmd

bash: runcmd: command not found

[brad@localhost muse]$ ls wibble

ls: cannot access wibble: No such file or directory

So when grepping for shell errors with a regex ... (more)

edit retag flag offensive close merge delete

Comments

puppet won't be changing the output anytime soon. Might I suggest logstash + grok as an alternative to regex-ing your logs. http://logstash.net

spuder gravatar imagespuder ( 2014-04-16 10:57:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-04-17 15:56:02 -0500

ffrank gravatar image

I don't think that it is sound to assume that a line starting with command-name + colon is an error.

Errors should be expected to be printed to stderr, while it should be safe to discard stdout if informational messages do not concern you. The Puppet agent does adhere to this standard.

E.g.

puppet agent --test 2>>/var/log/puppet-errors.log
puppet agent --test >/dev/null
edit flag offensive delete link more

Comments

Thanks Frank. Actually my automation harness parses all output and produces summary reports so I want both. However its my problem :) Just thought I would point out that the pattern for the output is the same as a shell error. You have given me an idea though, perhaps I'll tee stderr and parse it separately. My library of Puppet functions allows me to filter out expected errors and report unexpected ones..... Cheers Brad

steadyonabix gravatar imagesteadyonabix ( 2014-04-22 03:10:38 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-04-16 09:05:52 -0500

Seen: 1,186 times

Last updated: Apr 17 '14