From d90834b77f31f186ab72f41680c1f15357b7cdba Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 26 Jun 2020 10:29:24 +0200 Subject: [PATCH] ceph-volume.py: add support for batch refactored code See https://github.com/ceph/ceph/pull/34740 for the batch changes. Signed-off-by: Jan Fajerski --- library/ceph_volume.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 7e9b916af..8c42de6e2 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -714,10 +714,17 @@ def run_module(): module.fail_json(msg='non-zero return code', **result) if not report: - # if not asking for a report, let's just run the batch command - changed = report_result['changed'] - if changed: - # Batch prepare the OSD + if 'changed' in report_result: + # we have the old batch implementation + # if not asking for a report, let's just run the batch command + changed = report_result['changed'] + if changed: + # Batch prepare the OSD + rc, cmd, out, err = exec_command( + module, batch(module, container_image)) + else: + # we have the refactored batch, its idempotent so lets just + # run it rc, cmd, out, err = exec_command( module, batch(module, container_image)) else: