From aaee3ddb778050266ed9ee60e8c8f641edd24dbb Mon Sep 17 00:00:00 2001 From: David Bidorff Date: Tue, 17 Dec 2024 17:17:07 +0100 Subject: [PATCH] fix: improve versions checks --- plugins/modules/helm.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index c97f0ae068..23dbf83065 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -538,9 +538,9 @@ def deploy( deploy_command += " --reuse-values=" + str(reuse_values) if reset_then_reuse_values: - helm_diff_version = get_plugin_version("diff") - if LooseVersion(helm_diff_version) < LooseVersion("3.9.12"): - module.warn("helm diff support option --reset-then-reuse-values starting release >= 3.9.12") + helm_version = module.get_helm_version() + if LooseVersion(helm_version) < LooseVersion("3.14.0"): + module.warn("helm support option --reset-then-reuse-values starting release >= 3.14.0") else: deploy_command += " --reset-then-reuse-values" @@ -696,7 +696,14 @@ def helmdiff_check( cmd += " --reuse-values" if reset_then_reuse_values: - cmd += " --reset-then-reuse-values" + helm_diff_version = get_plugin_version("diff") + helm_version = module.get_helm_version() + if LooseVersion(helm_diff_version) < LooseVersion("3.9.12"): + module.warn("helm diff support option --reset-then-reuse-values starting release >= 3.9.12") + elif LooseVersion(helm_version) < LooseVersion("3.14.0"): + module.warn("helm support option --reset-then-reuse-values starting release >= 3.14.0") + else: + cmd += " --reset-then-reuse-values" rc, out, err = module.run_helm_command(cmd) return (len(out.strip()) > 0, out.strip())