mirror of https://github.com/docker/docs.git
Simpler code
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
e2c4801a93
commit
6f53a0b9ed
|
@ -21,8 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
validHostNameChars = `^[a-zA-Z0-9][a-zA-Z0-9\-\.]*$`
|
validHostNamePattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\.]*$`)
|
||||||
validHostNamePattern = regexp.MustCompile(validHostNameChars)
|
|
||||||
errMachineMustBeRunningForUpgrade = errors.New("Error: machine must be running to upgrade.")
|
errMachineMustBeRunningForUpgrade = errors.New("Error: machine must be running to upgrade.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -69,13 +68,9 @@ func (h *Host) CreateSSHClient() (ssh.Client, error) {
|
||||||
return ssh.ExternalClient{}, err
|
return ssh.ExternalClient{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var auth *ssh.Auth
|
auth := &ssh.Auth{}
|
||||||
if h.Driver.GetSSHKeyPath() == "" {
|
if h.Driver.GetSSHKeyPath() != "" {
|
||||||
auth = &ssh.Auth{}
|
auth.Keys = []string{h.Driver.GetSSHKeyPath()}
|
||||||
} else {
|
|
||||||
auth = &ssh.Auth{
|
|
||||||
Keys: []string{h.Driver.GetSSHKeyPath()},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ssh.NewClient(h.Driver.GetSSHUsername(), addr, port, auth)
|
return ssh.NewClient(h.Driver.GetSSHUsername(), addr, port, auth)
|
||||||
|
@ -181,9 +176,5 @@ func (h *Host) ConfigureAuth() error {
|
||||||
// and modularity of the provisioners should be).
|
// and modularity of the provisioners should be).
|
||||||
//
|
//
|
||||||
// Call provision to re-provision the certs properly.
|
// Call provision to re-provision the certs properly.
|
||||||
if err := provisioner.Provision(swarm.Options{}, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions); err != nil {
|
return provisioner.Provision(swarm.Options{}, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue