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 <dsavinea@redhat.com>
pull/6238/head
Dimitri Savineau 2021-01-20 21:02:17 -05:00 committed by Guillaume Abrioux
parent 76a663245d
commit 8939dddff4
2 changed files with 3 additions and 3 deletions

View 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

View 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