]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-key: check for key existance on absent state
authorSeena Fallah <seenafallah@gmail.com>
Mon, 20 May 2024 12:52:30 +0000 (14:52 +0200)
committerGuillaume Abrioux <gabrioux@ibm.com>
Tue, 21 May 2024 07:39:41 +0000 (09:39 +0200)
check if the key is exists before removal.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
library/ceph_key.py

index 492517b2137d004ebfd3266f198930f9725bc4f6..02bed855461c99c1ada7b82bdc6f16fb76553216 100644 (file)
@@ -617,11 +617,12 @@ def run_module():
             changed = True
 
     elif state == "absent":
-        if key_exist == 0:
+        rc, cmd, out, err = exec_commands(
+            module, info_key(cluster, name, user, user_key_path, output_format, container_image))  # noqa: E501
+        if rc == 0:
             rc, cmd, out, err = exec_commands(
                 module, delete_key(cluster, user, user_key_path, name, container_image))  # noqa: E501
-            if rc == 0:
-                changed = True
+            changed = True
         else:
             rc = 0