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 a7a2fa7c01..18314f7a8c 100644 --- a/plugins/module_utils/helm.py +++ b/plugins/module_utils/helm.py @@ -117,7 +117,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