]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
library: fix a bug in ceph_key module
authorGuillaume Abrioux <gabrioux@redhat.com>
Sat, 24 Sep 2022 05:15:36 +0000 (07:15 +0200)
committerTeoman ONAY <tonay@redhat.com>
Wed, 31 May 2023 21:07:13 +0000 (23:07 +0200)
`name` is a mandatory parameter when `state` is either
`present` or `absent` or `update` or `info`.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
library/ceph_key.py

index a0ca3b2a0f3608daef9ca964e5fed11f1da10648..a444b2d883d1c31e899974aa669aec8290fe42bb 100644 (file)
@@ -519,6 +519,10 @@ def run_module():
     user_key = module.params.get('user_key')
     output_format = module.params.get('output_format')
 
+    # Can't use required_if with 'name' for some reason...
+    if state in ['present', 'absent', 'update', 'info'] and not name:
+        fatal(f'"state" is "{state}" but "name" is not defined.', module)
+
     changed = False
 
     result = dict(