From 8d2ddf29fc3ccdcf2aacab8822f5914d849f1db3 Mon Sep 17 00:00:00 2001 From: Yuriy Novostavskiy Date: Wed, 11 Dec 2024 18:44:48 +0200 Subject: [PATCH] consider support of logout when user is not logged in Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> --- plugins/modules/helm_registry_auth.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/modules/helm_registry_auth.py b/plugins/modules/helm_registry_auth.py index ad9dd8150e..62bcef9e63 100644 --- a/plugins/modules/helm_registry_auth.py +++ b/plugins/modules/helm_registry_auth.py @@ -218,12 +218,15 @@ def main(): rc, out, err = module.run_helm_command(helm_cmd, data=password) if rc != 0: - module.fail_json( - msg="Failure when executing Helm command. Exited {0}.\nstdout: {1}\nstderr: {2}".format( + if state == "absent" and "Error: not logged in" in err: + changed = False + else: + module.fail_json( + msg="Failure when executing Helm command. Exited {0}.\nstdout: {1}\nstderr: {2}".format( rc, out, err - ), - command=helm_cmd, - ) + ), + command=helm_cmd, + ) module.exit_json(changed=changed, stdout=out, stderr=err, command=helm_cmd)