diff --git a/changelogs/fragments/654-helm-expand-user.yml b/changelogs/fragments/654-helm-expand-user.yml new file mode 100644 index 0000000000..b14a00e034 --- /dev/null +++ b/changelogs/fragments/654-helm-expand-user.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - helm - expand kubeconfig path with user's home directory for consistency with k8s diff --git a/plugins/module_utils/helm.py b/plugins/module_utils/helm.py index 8bd06eccde..faa12c03ad 100644 --- a/plugins/module_utils/helm.py +++ b/plugins/module_utils/helm.py @@ -115,7 +115,7 @@ def _prepare_helm_environment(self): kubeconfig = self.params.get("kubeconfig") if kubeconfig: if isinstance(kubeconfig, string_types): - with open(kubeconfig) as fd: + with open(os.path.expanduser(kubeconfig)) as fd: kubeconfig_content = yaml.safe_load(fd) elif isinstance(kubeconfig, dict): kubeconfig_content = kubeconfig