From 714c2f671193debec82a93b2f50cb6c9e111efae Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 10:56:28 -0400 Subject: [PATCH] fix(helm_repository): strip trailing slashes from repo_url (#1121) (#1126) Helm normalizes repository URLs internally, so a URL supplied with a trailing slash and the same URL without one are treated as different entries. This causes the module to fail every run when the user provides a trailing slash, even though the repository is already correctly registered. Strip the trailing slash from repo_url before comparing against the existing repository list so repeated runs with the same input are idempotent. Fixes #480 (cherry picked from commit 8a58d3b6de286a05d6be60bef3d8ed83d62547bc) Co-authored-by: Yuriy Novostavskiy --- .../20260506-improve_idempotency_for_helm_repository.yaml | 2 ++ plugins/modules/helm_repository.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/20260506-improve_idempotency_for_helm_repository.yaml diff --git a/changelogs/fragments/20260506-improve_idempotency_for_helm_repository.yaml b/changelogs/fragments/20260506-improve_idempotency_for_helm_repository.yaml new file mode 100644 index 00000000..9c1599fa --- /dev/null +++ b/changelogs/fragments/20260506-improve_idempotency_for_helm_repository.yaml @@ -0,0 +1,2 @@ +bugfixes: + - helm_repository - correct handling of repository URLs with trailing slashes (https://github.com/ansible-collections/kubernetes.core/pull/1121). diff --git a/plugins/modules/helm_repository.py b/plugins/modules/helm_repository.py index fabfae63..62326968 100644 --- a/plugins/modules/helm_repository.py +++ b/plugins/modules/helm_repository.py @@ -302,6 +302,8 @@ def main(): repo_name = module.params.get("repo_name") repo_url = module.params.get("repo_url") + if repo_url: + repo_url = repo_url.rstrip("/") repo_username = module.params.get("repo_username") repo_password = module.params.get("repo_password") repo_state = module.params.get("repo_state")