From 52365166a4b3757d174b602891fb54bc751defe0 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Mon, 20 May 2024 14:52:30 +0200 Subject: [PATCH] ceph-key: check for key existance on absent state check if the key is exists before removal. Signed-off-by: Seena Fallah --- library/ceph_key.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/ceph_key.py b/library/ceph_key.py index 492517b213..02bed85546 100644 --- a/library/ceph_key.py +++ b/library/ceph_key.py @@ -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