mirror of https://github.com/ceph/ceph-ansible.git
ceph-volume: be idempotent when the batch strategy changes
If you deploy with 2 HDDs and 1 SDD then each subsequent deploy both
HDD drives will be filtered out, because they're already used by ceph.
ceph-volume will report this as a 'strategy change' because the device
list went from a mixed type of HDD and SDD to a single type of only SDD.
This situation results in a non-zero exit code from ceph-volume. We want
to handle this situation gracefully and report that nothing will be changed.
A similar json structure to what would have been given by ceph-volume is
returned in the 'stdout' key.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1650306
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit e13f32c1c5
)
pull/3370/head
parent
1a1886a442
commit
59524c7246
|
@ -578,13 +578,22 @@ 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
|
||||||
|
if strategy_change:
|
||||||
|
out = json.dumps({"changed": False, "stdout": out.rstrip("\r\n")})
|
||||||
|
rc = 0
|
||||||
|
changed = False
|
||||||
|
else:
|
||||||
|
out = out.rstrip("\r\n")
|
||||||
result = dict(
|
result = dict(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
stdout=out.rstrip(b"\r\n"),
|
stdout=out,
|
||||||
stderr=err.rstrip(b"\r\n"),
|
stderr=err.rstrip("\r\n"),
|
||||||
rc=rc,
|
rc=rc,
|
||||||
changed=changed,
|
changed=changed,
|
||||||
)
|
)
|
||||||
|
if strategy_change:
|
||||||
|
module.exit_json(**result)
|
||||||
module.fail_json(msg='non-zero return code', **result)
|
module.fail_json(msg='non-zero return code', **result)
|
||||||
|
|
||||||
if not report:
|
if not report:
|
||||||
|
|
Loading…
Reference in New Issue