]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
radosgw_user: handle non-existence user on check mode
authorSeena Fallah <seenafallah@gmail.com>
Wed, 24 Apr 2024 16:59:48 +0000 (18:59 +0200)
committerSeena Fallah <seenafallah@gmail.com>
Mon, 6 May 2024 10:11:32 +0000 (12:11 +0200)
Set return code to 0 on check mode when the user doesn't exists and it will fail the module.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 878cce5b4847a9a112f9d07c0fd651aa15f1e58b)

library/radosgw_user.py

index 2370a4ddd48bb24c4fc7eeea233a8f46b9bd1780..78addd0cd71d6d57108adc7ecef33c60591958aa 100644 (file)
@@ -455,9 +455,11 @@ def run_module():
             if changed and not module.check_mode:
                 rc, cmd, out, err = exec_commands(module, modify_user(module, container_image=container_image))  # noqa: E501
         else:
+            changed = True
             if not module.check_mode:
                 rc, cmd, out, err = exec_commands(module, create_user(module, container_image=container_image))  # noqa: E501
-            changed = True
+            else:
+                rc = 0
 
     elif state == "absent":
         if rc == 0: