ceph-key: check for key existance on absent state

check if the key is exists before removal.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
pull/7566/head
Seena Fallah 2024-05-20 14:52:30 +02:00 committed by Guillaume Abrioux
parent 7016c6df3c
commit 52365166a4
1 changed files with 4 additions and 3 deletions

View File

@ -617,10 +617,11 @@ def run_module():
changed = True changed = True
elif state == "absent": 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( rc, cmd, out, err = exec_commands(
module, delete_key(cluster, user, user_key_path, name, container_image)) # noqa: E501 module, delete_key(cluster, user, user_key_path, name, container_image)) # noqa: E501
if rc == 0:
changed = True changed = True
else: else:
rc = 0 rc = 0