mirror of https://github.com/ceph/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 <bknecht@protonmail.ch>
(cherry picked from commit 85dd405814
)
4.2rc
parent
71f98531a9
commit
63aa1950d9
|
@ -166,14 +166,14 @@ def run_module():
|
||||||
changed=False,
|
changed=False,
|
||||||
stdout='',
|
stdout='',
|
||||||
stderr='',
|
stderr='',
|
||||||
rc='',
|
rc=0,
|
||||||
start='',
|
start='',
|
||||||
end='',
|
end='',
|
||||||
delta='',
|
delta='',
|
||||||
)
|
)
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
return result
|
module.exit_json(**result)
|
||||||
|
|
||||||
startd = datetime.datetime.now()
|
startd = datetime.datetime.now()
|
||||||
|
|
||||||
|
|
|
@ -530,14 +530,15 @@ def run_module():
|
||||||
changed=changed,
|
changed=changed,
|
||||||
stdout='',
|
stdout='',
|
||||||
stderr='',
|
stderr='',
|
||||||
rc='',
|
rc=0,
|
||||||
start='',
|
start='',
|
||||||
end='',
|
end='',
|
||||||
delta='',
|
delta='',
|
||||||
)
|
)
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
return result
|
module.exit_json(**result)
|
||||||
|
|
||||||
startd = datetime.datetime.now()
|
startd = datetime.datetime.now()
|
||||||
|
|
||||||
# will return either the image name or None
|
# will return either the image name or None
|
||||||
|
|
|
@ -566,14 +566,14 @@ def run_module():
|
||||||
changed=False,
|
changed=False,
|
||||||
stdout='',
|
stdout='',
|
||||||
stderr='',
|
stderr='',
|
||||||
rc='',
|
rc=0,
|
||||||
start='',
|
start='',
|
||||||
end='',
|
end='',
|
||||||
delta='',
|
delta='',
|
||||||
)
|
)
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
return result
|
module.exit_json(**result)
|
||||||
|
|
||||||
# start execution
|
# start execution
|
||||||
startd = datetime.datetime.now()
|
startd = datetime.datetime.now()
|
||||||
|
|
Loading…
Reference in New Issue