Redirect stderr to stdout in push_cib() and backup_cib()

With this change we are sure we capture any useful logs output by pcs on
stderr:

Before the change:
Error: Unable to write to file '/tmp2/foo.xml', No such file or directory
backup_cib: Running: pcs cluster cib /tmp2/foo.xml with code: 1 ->

After the change:
backup_cib: Running: pcs cluster cib /tmp2/foo.xml with code: 1 -> Error: Unable to write to file '/tmp2/foo.xml', No such file or directory

Change-Id: I41a534e4a162e0f0135c67fe52ed38de7249f091
This commit is contained in:
Michele Baldessari 2019-06-12 17:07:21 +02:00
parent fde568564d
commit 658f4ee6d9
1 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ def backup_cib()
# We use the pacemaker CIB folder because of its restricted access permissions
cib = pcmk_tmpname("#{PCMK_TMP_BASE}/puppet-cib-backup", nil)
cmd = "#{PCS_BIN} cluster cib #{cib}"
output = `#{cmd}`
output = `#{cmd} 2>&1`
ret = $?
if not ret.success?
msg = "backup_cib: Running: #{cmd} failed with code: #{ret.exitstatus} -> #{output}"
@ -97,7 +97,7 @@ def push_cib(cib)
if has_diffagainst
cmd += " diff-against=#{cib}.orig"
end
output = `#{cmd}`
output = `#{cmd} 2>&1`
ret = $?
delete_cib(cib)
if not ret.success?