library/ceph_volume: look for error messages in stderr

Error message were moved to from stdout in stderr here -
b8d6dcbe9f (diff-20f7c578a4e69ec61a5869d706567a24R137).

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1793542
Signed-off-by: Rishabh Dave <ridave@redhat.com>
pull/5288/head
Rishabh Dave 2020-04-07 17:20:35 +05:30 committed by Guillaume Abrioux
parent afa78bd0c0
commit 4249d1e02d
1 changed files with 12 additions and 5 deletions

View File

@ -649,10 +649,17 @@ def run_module():
try: try:
report_result = json.loads(out) report_result = json.loads(out)
except ValueError: except ValueError:
strategy_change = "strategy changed" in out strategy_changed_in_out = "strategy changed" in out
if strategy_change: strategy_changed_in_err = "strategy changed" in err
out = json.dumps( strategy_changed = strategy_changed_in_out or \
{"changed": False, "stdout": out.rstrip("\r\n")}) strategy_changed_in_err
if strategy_changed:
if strategy_changed_in_out:
out = json.dumps({"changed": False,
"stdout": out.rstrip("\r\n")})
elif strategy_changed_in_err:
out = json.dumps({"changed": False,
"stderr": err.rstrip("\r\n")})
rc = 0 rc = 0
changed = False changed = False
else: else:
@ -664,7 +671,7 @@ def run_module():
rc=rc, rc=rc,
changed=changed, changed=changed,
) )
if strategy_change: if strategy_changed:
module.exit_json(**result) module.exit_json(**result)
module.fail_json(msg='non-zero return code', **result) module.fail_json(msg='non-zero return code', **result)