Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMK-6577 fix hostagent env #389

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build
.env
pf9ctl
.DS_Store

/vendor
18 changes: 11 additions & 7 deletions cmd/putNodeBehindProxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ func putNodeBehindProxyRun(cmd *cobra.Command, args []string) {
commsProxyFilePath := "/etc/pf9/comms_proxy_cfg.json"
hostAgentEnvFile := "/opt/pf9/hostagent/pf9-hostagent.env"

var envs = "export http_proxy=" + proxy_url + "\n" +
"export https_proxy=" + proxy_url + "\n" +
"export HTTP_PROXY=" + proxy_url + "\n" +
"export HTTPS_PROXY=" + proxy_url + "\n" +
"export no_proxy=" + noProxy + "\n" +
"export NO_PROXY=" + noProxy
var envs = "http_proxy=" + proxy_url + "\n" +
"https_proxy=" + proxy_url + "\n" +
"HTTP_PROXY=" + proxy_url + "\n" +
"HTTPS_PROXY=" + proxy_url

if noProxyList != "" {
envs = envs + "\n" + "no_proxy=" + noProxyList + "\n" + "NO_PROXY=" + noProxyList
} else {
envs = envs + "\n" + "no_proxy=" + noProxy + "\n" + "NO_PROXY=" + noProxy
}

detachedMode := cmd.Flags().Changed("no-prompt")

Expand Down Expand Up @@ -96,7 +100,7 @@ func putNodeBehindProxyRun(cmd *cobra.Command, args []string) {
zap.S().Fatalf("Failed while moving temp file back to original file %s ", hostAgentEnvFile)
}
//Remove temp file
cmnd = fmt.Sprintf("rm -rf /opt/pf9/hostagent/pf9-hostagent.env.tmp")
cmnd = "rm -rf /opt/pf9/hostagent/pf9-hostagent.env.tmp"
_, err = executor.RunWithStdout("bash", "-c", cmnd)
if err != nil {
zap.S().Debugf("File %s.tmp not removed", hostAgentEnvFile)
Expand Down
Loading