radosgw_user: handle non-existence user on check mode

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>
pull/7554/head
Seena Fallah 2024-04-24 18:59:48 +02:00 committed by Guillaume Abrioux
parent 4f6641fe5c
commit 878cce5b48
1 changed files with 3 additions and 1 deletions

View File

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