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

Changed docker-machine and sshutil to support hostnames with colons i… #625

Merged
merged 1 commit into from
Sep 23, 2016

Conversation

aaron-prindle
Copy link
Contributor

…n them, for example ipv6 addresses

@@ -52,7 +52,7 @@ func NewSSHClient(d drivers.Driver) (*ssh.Client, error) {
return nil, errors.Wrapf(err, "Error creating new native config from ssh using: %s, %s", h.Username, auth)
}

client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", h.IP, h.Port), &config)
client, err := ssh.Dial("tcp", fmt.Sprintf("[%s]:%d", h.IP, h.Port), &config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're better off using net.JoinHostPort here.

@@ -166,7 +166,7 @@ func (client *NativeClient) session(command string) (*ssh.Session, error) {
return nil, fmt.Errorf("Error attempting SSH client dial: %s", err)
}

conn, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config)
conn, err := ssh.Dial("tcp", fmt.Sprintf("[%s]:%d", client.Hostname, client.Port), &client.Config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use net.JoinHostPort.

@@ -250,7 +250,7 @@ func (client *NativeClient) Shell(args ...string) error {
var (
termWidth, termHeight int
)
conn, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config)
conn, err := ssh.Dial("tcp", fmt.Sprintf("[%s]:%d", client.Hostname, client.Port), &client.Config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use net.JoinHostPort.

@aaron-prindle
Copy link
Contributor Author

aaron-prindle commented Sep 23, 2016

Now using net.JoinHostPort. Thanks!

@codecov-io
Copy link

codecov-io commented Sep 23, 2016

Current coverage is 32.95% (diff: 100%)

Merging #625 into master will not change coverage

@@             master       #625   diff @@
==========================================
  Files            44         44          
  Lines          1933       1933          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            637        637          
  Misses         1168       1168          
  Partials        128        128          

Powered by Codecov. Last update ed08f69...378e88b

@aaron-prindle aaron-prindle merged commit 2b8e858 into kubernetes:master Sep 23, 2016
Copy link
Contributor

@dlorenc dlorenc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you send a PR to docker machine with this change too?

@aaron-prindle
Copy link
Contributor Author

aaron-prindle commented Sep 23, 2016

PR to docker machine is here:
docker/machine#3783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants