Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Commit 6237176

Browse files
author
Anthony Emengo
committed
Make director.go ssh invocations support all platforms
For some reason, scp'ing files to the /bosh directory on the bosh-bootstrap container on windows NEVER worked. Have put it in /root/* instead for windows sake.
1 parent 1f74516 commit 6237176

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

provision/director.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,27 @@ func (c *Controller) DeployBosh() error {
5858
}
5959
defer s.Close()
6060

61-
if runtime.GOOS == "linux" {
62-
directorContents, err := ioutil.ReadFile(directorPath)
63-
if err != nil {
64-
return err
65-
}
61+
directorContents, err := ioutil.ReadFile(directorPath)
62+
if err != nil {
63+
return err
64+
}
6665

66+
if runtime.GOOS == "linux" {
6767
directorContents = bytes.Replace(directorContents, []byte(vpnkitInternalIP+":9999"), []byte(ip+":9999"), -1)
6868

6969
directorContents = bytes.Replace(directorContents, []byte(vpnkitNameserverIP), []byte(kvmNameserverIP), -1)
70-
71-
s.SendData(directorContents, "/bosh/director.yml")
7270
}
7371

74-
s.SendFile(stateJSONPath, "/bosh/state.json")
72+
s.SendData(directorContents, "director.yml")
73+
74+
s.SendFile(stateJSONPath, "state.json")
7575

76-
command := "/usr/local/bin/bosh --tty create-env /bosh/director.yml --state /bosh/state.json"
76+
command := "/usr/local/bin/bosh --tty create-env director.yml --state state.json"
7777

7878
if !credhubIsDeployed() {
79-
s.SendFile(credsPath, "/bosh/creds.yml")
79+
s.SendFile(credsPath, "creds.yml")
8080

81-
command = command + " --vars-store /bosh/creds.yml"
81+
command = command + " --vars-store creds.yml"
8282
}
8383

8484
// Added the time because we were seeing some delay
@@ -89,7 +89,7 @@ func (c *Controller) DeployBosh() error {
8989

9090
s.Run(command)
9191

92-
s.RetrieveFile(stateJSONPath, "/bosh/state.json")
92+
s.RetrieveFile(stateJSONPath, "state.json")
9393
if s.Error != nil {
9494
return s.Error
9595
}

provision/ssh.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func (s *SSH) SendData(srcData []byte, remoteFilePath string) {
9494

9595
go func() {
9696
w, _ := session.StdinPipe()
97+
defer w.Close()
9798

9899
fmt.Fprintln(w, "C0755", int64(len(srcData)), filepath.Base(remoteFilePath))
99100
_, err := io.Copy(w, bytesReader)

0 commit comments

Comments
 (0)