fix(helm_repository): strip trailing slashes from repo_url (#1121)

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 8a58d3b6de)
This commit is contained in:
Yuriy Novostavskiy
2026-05-14 02:44:39 +02:00
committed by patchback[bot]
parent a2aa079829
commit 4dfcb8a500
2 changed files with 4 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
bugfixes:
- helm_repository - correct handling of repository URLs with trailing slashes (https://github.com/ansible-collections/kubernetes.core/pull/1121).

View File

@@ -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")