From: Benoît Knecht Date: Tue, 1 Sep 2020 11:06:57 +0000 (+0200) Subject: library: Fix new-style modules check mode X-Git-Tag: v4.0.36~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bff21234303b9086dd8a352b52f2f47c5f3d2251;p=ceph-ansible.git library: Fix new-style modules check mode Running the `ceph_crush.py`, `ceph_key.py` or `ceph_volume.py` modules in check mode resulted in the following error: ``` New-style module did not handle its own exit ``` This was due to the fact that they simply returned a `dict` in that case, instead of calling `module.exit_json()`. Signed-off-by: Benoît Knecht (cherry picked from commit 85dd4058145436e86a12ad9f015f5228189437d5) --- diff --git a/library/ceph_crush.py b/library/ceph_crush.py index 7891b666a..6ada0b459 100644 --- a/library/ceph_crush.py +++ b/library/ceph_crush.py @@ -166,14 +166,14 @@ def run_module(): changed=False, stdout='', stderr='', - rc='', + rc=0, start='', end='', delta='', ) if module.check_mode: - return result + module.exit_json(**result) startd = datetime.datetime.now() diff --git a/library/ceph_key.py b/library/ceph_key.py index 7ef4c625e..ab818a76f 100644 --- a/library/ceph_key.py +++ b/library/ceph_key.py @@ -540,14 +540,14 @@ def run_module(): changed=changed, stdout='', stderr='', - rc='', + rc=0, start='', end='', delta='', ) if module.check_mode: - return result + module.exit_json(**result) startd = datetime.datetime.now() diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 77bda89c5..a2b55ee58 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -566,14 +566,14 @@ def run_module(): changed=False, stdout='', stderr='', - rc='', + rc=0, start='', end='', delta='', ) if module.check_mode: - return result + module.exit_json(**result) # start execution startd = datetime.datetime.now()