From c59db1990bb25dca0760398a322a0e6cacaab76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20H=C3=BCgli?= Date: Thu, 4 Feb 2021 20:08:10 +0100 Subject: [PATCH 1/6] fix has_plugin detection method --- plugins/modules/helm.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index 993def91..1da12713 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -407,10 +407,7 @@ def has_plugin(command, plugin): cmd = command + " plugin list" rc, out, err = run_helm(module, cmd) for line in out.splitlines(): - if line.startswith("NAME"): - continue - name, _rest = line.split("\t", 1) - if name == plugin: + if line.lstrip().startswith(plugin): return True return False From a48ef03ed162e6ac608c818c2a533fa39f04cccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20H=C3=BCgli?= Date: Thu, 4 Feb 2021 21:28:12 +0100 Subject: [PATCH 2/6] use even better method :) --- plugins/modules/helm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index 1da12713..ae12f134 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -407,7 +407,10 @@ def has_plugin(command, plugin): cmd = command + " plugin list" rc, out, err = run_helm(module, cmd) for line in out.splitlines(): - if line.lstrip().startswith(plugin): + if line.startswith("NAME"): + continue + name, _rest = line.split(None, 1) + if name == plugin: return True return False From ccb20fdf0c186055c3f61674dd6299e1e750e6fa Mon Sep 17 00:00:00 2001 From: joschi36 Date: Thu, 4 Feb 2021 21:35:46 +0100 Subject: [PATCH 3/6] add changelog fragment --- changelogs/fragments/362-helm-has_plugin-fix | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/362-helm-has_plugin-fix diff --git a/changelogs/fragments/362-helm-has_plugin-fix b/changelogs/fragments/362-helm-has_plugin-fix new file mode 100644 index 00000000..ce9b5571 --- /dev/null +++ b/changelogs/fragments/362-helm-has_plugin-fix @@ -0,0 +1,2 @@ +bugfixes: + - helm - make helm-diff plugin detection more reliable by splitting by any whitespace instead of explicit whitespace (`\s`) From 430e580ec996826bfbcd16fa1a28a52dcc28a562 Mon Sep 17 00:00:00 2001 From: joschi36 Date: Thu, 4 Feb 2021 21:57:32 +0100 Subject: [PATCH 4/6] fix forgotten file extension --- .../{362-helm-has_plugin-fix => 362-helm-has_plugin-fix.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelogs/fragments/{362-helm-has_plugin-fix => 362-helm-has_plugin-fix.yaml} (100%) diff --git a/changelogs/fragments/362-helm-has_plugin-fix b/changelogs/fragments/362-helm-has_plugin-fix.yaml similarity index 100% rename from changelogs/fragments/362-helm-has_plugin-fix rename to changelogs/fragments/362-helm-has_plugin-fix.yaml From efe6fffd0fd236930516fb1ad4f6ab3a5afa2ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20H=C3=BCgli?= Date: Sun, 14 Feb 2021 13:45:43 +0100 Subject: [PATCH 5/6] Double Backticks ;) --- changelogs/fragments/362-helm-has_plugin-fix.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/362-helm-has_plugin-fix.yaml b/changelogs/fragments/362-helm-has_plugin-fix.yaml index ce9b5571..1bd65c53 100644 --- a/changelogs/fragments/362-helm-has_plugin-fix.yaml +++ b/changelogs/fragments/362-helm-has_plugin-fix.yaml @@ -1,2 +1,2 @@ bugfixes: - - helm - make helm-diff plugin detection more reliable by splitting by any whitespace instead of explicit whitespace (`\s`) + - helm - make helm-diff plugin detection more reliable by splitting by any whitespace instead of explicit whitespace (``\s``) From 72b77720dd74e7227b2c45f3b0fc18de10b4d8d2 Mon Sep 17 00:00:00 2001 From: Mike Graves Date: Tue, 16 Feb 2021 11:46:28 -0500 Subject: [PATCH 6/6] Add PR link to changelog --- changelogs/fragments/362-helm-has_plugin-fix.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/362-helm-has_plugin-fix.yaml b/changelogs/fragments/362-helm-has_plugin-fix.yaml index 1bd65c53..1794f220 100644 --- a/changelogs/fragments/362-helm-has_plugin-fix.yaml +++ b/changelogs/fragments/362-helm-has_plugin-fix.yaml @@ -1,2 +1,2 @@ bugfixes: - - helm - make helm-diff plugin detection more reliable by splitting by any whitespace instead of explicit whitespace (``\s``) + - helm - make helm-diff plugin detection more reliable by splitting by any whitespace instead of explicit whitespace (``\s``) (https://github.com/ansible-collections/community.kubernetes/pull/362).