]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
library: fix idempotency in ceph_mgr_module
authorDimitri Savineau <dsavinea@redhat.com>
Thu, 21 Jan 2021 02:02:17 +0000 (21:02 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 3 Feb 2021 07:30:44 +0000 (08:30 +0100)
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 <dsavinea@redhat.com>
library/ceph_mgr_module.py
tests/library/test_ceph_mgr_module.py

index e82ae6e22e1985575f95db9fb72696bd2ff2363a..54095a0c39d166ad37d3023bd0b2fa4116e106b7 100644 (file)
@@ -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
index f577c20e98c7efaeb73c5eb7acdb7f3deedaf394..efd87bf085319f4e199238f5513511491bfad0ce 100644 (file)
@@ -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