Skip to content

Commit

Permalink
Merge pull request #319 from cloudfoundry/ipv6_sep_19
Browse files Browse the repository at this point in the history
Remove IPv6 bracketing from ssh shell out
  • Loading branch information
zachgersh authored Oct 11, 2017
2 parents 3b55fdd + b32167d commit be8570e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ssh/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (r InteractiveRunner) Run(connOpts ConnectionOpts, result boshdir.SSHResult
cmdFactory := func(host boshdir.Host) boshsys.Command {
return boshsys.Command{
Name: "ssh",
Args: []string{printableHost{host}.String(), "-l", host.Username},
Args: []string{host.Host, "-l", host.Username},

Stdin: os.Stdin,
Stdout: os.Stdout,
Expand Down
2 changes: 1 addition & 1 deletion ssh/non_interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r NonInteractiveRunner) Run(connOpts ConnectionOpts, result boshdir.SSHRes
cmdFactory := func(host boshdir.Host) boshsys.Command {
return boshsys.Command{
Name: "ssh",
Args: append([]string{printableHost{host}.String(), "-l", host.Username}, rawCmd...),
Args: append([]string{host.Host, "-l", host.Username}, rawCmd...),
}
}

Expand Down
2 changes: 1 addition & 1 deletion ssh/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (r SessionImpl) makeKnownHostsFile() (boshsys.File, error) {

for _, host := range r.result.Hosts {
if len(host.HostPublicKey) > 0 {
content += fmt.Sprintf("%s %s\n", printableHost{host}, host.HostPublicKey)
content += fmt.Sprintf("%s %s\n", host.Host, host.HostPublicKey)
}
}

Expand Down
2 changes: 1 addition & 1 deletion ssh/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var _ = Describe("SessionImpl", func() {
_, err := act().Start()
Expect(err).ToNot(HaveOccurred())
Expect(fs.ReadFileString("/tmp/known-hosts")).To(Equal(
"127.0.0.1 pub-key1\n127.0.0.2 pub-key2\n[::1] pub-key3\n"))
"127.0.0.1 pub-key1\n127.0.0.2 pub-key2\n::1 pub-key3\n"))
})

It("returns error if cannot create known hosts temp file and deletes private key", func() {
Expand Down

0 comments on commit be8570e

Please sign in to comment.