From 09bcb57f0492a83ed4c466ac98478fbde5f3203c Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Tue, 29 Sep 2020 22:07:38 +0300 Subject: [PATCH] Test NO_PROXY is not empty on init scripts Signed-off-by: Lauri Nevala --- src/main/kubectl.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kubectl.ts b/src/main/kubectl.ts index 198bb7af2a..0103a59374 100644 --- a/src/main/kubectl.ts +++ b/src/main/kubectl.ts @@ -283,7 +283,9 @@ export class Kubectl { bashScript += "fi\n" bashScript += `export PATH="${helmPath}:${kubectlPath}:$PATH"\n` bashScript += "export KUBECONFIG=\"$tempkubeconfig\"\n" - bashScript += "if [ \"$NO_PROXY\" != \"localhost,127.0.0.1\" ]; then\n" + bashScript += "if [ -z \"$NO_PROXY\" ]; then\n" + bashScript += " export NO_PROXY=\"localhost,127.0.0.1\"\n" + bashScript += "elif [ \"$NO_PROXY\" != \"localhost,127.0.0.1\" ]; then\n" bashScript += " export NO_PROXY=\"localhost,127.0.0.1,$NO_PROXY\"\n" bashScript += "fi\n" bashScript += "unset tempkubeconfig\n" @@ -311,7 +313,9 @@ export class Kubectl { zshScript += "d=${d/#:/}\n" zshScript += "export PATH=\"$helmpath:$kubectlpath:${d/%:/}\"\n" zshScript += "export KUBECONFIG=\"$tempkubeconfig\"\n" - zshScript += "if [ \"$NO_PROXY\" != \"localhost,127.0.0.1\" ]; then\n" + zshScript += "if test -z \"$NO_PROXY\"; then\n" + zshScript += " export NO_PROXY=\"localhost,127.0.0.1\"\n" + zshScript += "elif [ \"$NO_PROXY\" != \"localhost,127.0.0.1\" ]; then\n" zshScript += " export NO_PROXY=\"localhost,127.0.0.1,$NO_PROXY\"\n" zshScript += "fi\n" zshScript += "unset tempkubeconfig\n"