Log puppet to syslog instead of json

Stop sending the complete puppet output back via json.  Do send
it to local syslog instead.

This is mostly because right now all of our puppet output is going
into a single very long json line in our log file.

Change-Id: Ie6d2d82def95ef2bb79ae862707218a44e0138ca
This commit is contained in:
James E. Blair 2016-01-21 14:19:10 -08:00 committed by Monty Taylor
parent e1c1430bd6
commit 7fff1b962c
1 changed files with 6 additions and 7 deletions

View File

@ -183,7 +183,7 @@ def main():
else:
cmd += " --no-noop"
else:
cmd = "%s apply --detailed-exitcodes " % base_cmd
cmd = "%s apply --detailed-exitcodes --logdest syslog" % base_cmd
if p['environment']:
cmd += "--environment '%s' " % p['environment']
if module.check_mode:
@ -195,7 +195,7 @@ def main():
if rc == 0:
# success
module.exit_json(rc=rc, changed=False, stdout=stdout)
module.exit_json(rc=rc, changed=False)
elif rc == 1:
# rc==1 could be because it's disabled
# rc==1 could also mean there was a compilation failure
@ -206,19 +206,18 @@ def main():
msg = "puppet did not run"
module.exit_json(
rc=rc, disabled=disabled, msg=msg,
error=True, stdout=stdout, stderr=stderr)
error=True)
elif rc == 2:
# success with changes
module.exit_json(rc=0, changed=True, stdout=stdout, stderr=stderr)
module.exit_json(rc=0, changed=True)
elif rc == 124:
# timeout
module.exit_json(
rc=rc, msg="%s timed out" % cmd, stdout=stdout, stderr=stderr)
rc=rc, msg="%s timed out" % cmd)
else:
# failure
module.fail_json(
rc=rc, msg="%s failed with return code: %d" % (cmd, rc),
stdout=stdout, stderr=stderr)
rc=rc, msg="%s failed with return code: %d" % (cmd, rc))
# import module snippets
from ansible.module_utils.basic import *