From: Dimitri Savineau Date: Thu, 21 Jan 2021 02:02:17 +0000 (-0500) Subject: library: fix idempotency in ceph_mgr_module X-Git-Tag: v6.0.0~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8939dddff46037aaa5c2d0fc3a52a065a2f3c44b;p=ceph-ansible.git library: fix idempotency in ceph_mgr_module The ceph mgr command output is printed on stderr instead of stdout which prevent to set the changed flag to false if the module is already enabled. Signed-off-by: Dimitri Savineau --- diff --git a/library/ceph_mgr_module.py b/library/ceph_mgr_module.py index e82ae6e22..54095a0c3 100644 --- a/library/ceph_mgr_module.py +++ b/library/ceph_mgr_module.py @@ -107,7 +107,7 @@ def main(): ) else: rc, out, err = module.run_command(cmd) - if out == "module '{}' is already enabled".format(name): + if 'is already enabled' in err: changed = False else: changed = True diff --git a/tests/library/test_ceph_mgr_module.py b/tests/library/test_ceph_mgr_module.py index f577c20e9..efd87bf08 100644 --- a/tests/library/test_ceph_mgr_module.py +++ b/tests/library/test_ceph_mgr_module.py @@ -93,8 +93,8 @@ class TestCephMgrModuleModule(object): 'name': fake_module, }) m_exit_json.side_effect = ca_test_common.exit_json - stdout = 'module \'{}\' is already enabled'.format(fake_module) - stderr = '' + stderr = 'module \'{}\' is already enabled'.format(fake_module) + stdout = '' rc = 0 m_run_command.return_value = rc, stdout, stderr