Fix disappearing Puppet logs
It seems that recently Puppet logs started disappearing. Passing `--logdest` to `puppet apply` multiple times was probably working before as described in change Id5212b3ed27b6299e33e81ecf71ead554f9bdd29, but it seems to work no longer. In my testing, the output went only into syslog, and if Puppet failed, we had no Puppet output in the Ansible logs. The fix is to only log to console (as is the default) and use `logger -s` to effectively `tee` the output into syslog too. The logger command also has `-t puppet-user` because that's how Puppet tags its output when running with `--logdest syslog`. Change-Id: I46194897640198b6d817faf00be1d565a680ec02 Closes-Bug: #1831887
This commit is contained in:
parent
dee66d8983
commit
fda0f4284b
@ -300,13 +300,12 @@ if not os.path.exists(sh_script):
|
||||
/usr/bin/puppet apply --summarize \
|
||||
--detailed-exitcodes \
|
||||
--color=false \
|
||||
--logdest syslog \
|
||||
--logdest console \
|
||||
--modulepath=/etc/puppet/modules:/usr/share/openstack-puppet/modules \
|
||||
$TAGS \
|
||||
$CHECK_MODE \
|
||||
/etc/config.pp
|
||||
rc=$?
|
||||
/etc/config.pp \
|
||||
2>&1 | logger -s -t puppet-user
|
||||
rc=${PIPESTATUS[0]}
|
||||
set -e
|
||||
if [ $rc -ne 2 -a $rc -ne 0 ]; then
|
||||
exit $rc
|
||||
|
@ -391,15 +391,17 @@
|
||||
|
||||
- name: Run puppet host configuration for step {{ step }}
|
||||
when: enable_puppet|bool
|
||||
command: >-
|
||||
shell: >-
|
||||
puppet apply {{ host_puppet_config_debug | default('') }}
|
||||
--modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
|
||||
--detailed-exitcodes
|
||||
--summarize
|
||||
--logdest syslog --logdest console --color=false
|
||||
--color=false
|
||||
{{ ansible_check_mode | bool | ternary('--noop', '') }}
|
||||
{{ ansible_check_mode | bool | ternary('--hiera_config /etc/puppet/check-mode/hiera.yaml', '') }}
|
||||
/var/lib/tripleo-config/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}puppet_step_config.pp
|
||||
2>&1 | logger -s -t puppet-user ;
|
||||
exit ${PIPESTATUS[0]}
|
||||
changed_when: outputs.rc == 2
|
||||
register: outputs
|
||||
failed_when: false
|
||||
|
Loading…
Reference in New Issue
Block a user