mirror of https://github.com/docker/docs.git
refactor commands.go to use host ssh and upgrade
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
21d83d4a4f
commit
e43da502f3
28
commands.go
28
commands.go
|
@ -16,18 +16,18 @@ import (
|
||||||
|
|
||||||
"github.com/docker/machine/drivers"
|
"github.com/docker/machine/drivers"
|
||||||
_ "github.com/docker/machine/drivers/amazonec2"
|
_ "github.com/docker/machine/drivers/amazonec2"
|
||||||
_ "github.com/docker/machine/drivers/azure"
|
//_ "github.com/docker/machine/drivers/azure"
|
||||||
_ "github.com/docker/machine/drivers/digitalocean"
|
//_ "github.com/docker/machine/drivers/digitalocean"
|
||||||
_ "github.com/docker/machine/drivers/google"
|
//_ "github.com/docker/machine/drivers/google"
|
||||||
_ "github.com/docker/machine/drivers/hyperv"
|
//_ "github.com/docker/machine/drivers/hyperv"
|
||||||
_ "github.com/docker/machine/drivers/none"
|
_ "github.com/docker/machine/drivers/none"
|
||||||
_ "github.com/docker/machine/drivers/openstack"
|
//_ "github.com/docker/machine/drivers/openstack"
|
||||||
_ "github.com/docker/machine/drivers/rackspace"
|
//_ "github.com/docker/machine/drivers/rackspace"
|
||||||
_ "github.com/docker/machine/drivers/softlayer"
|
//_ "github.com/docker/machine/drivers/softlayer"
|
||||||
_ "github.com/docker/machine/drivers/virtualbox"
|
//_ "github.com/docker/machine/drivers/virtualbox"
|
||||||
_ "github.com/docker/machine/drivers/vmwarefusion"
|
//_ "github.com/docker/machine/drivers/vmwarefusion"
|
||||||
_ "github.com/docker/machine/drivers/vmwarevcloudair"
|
//_ "github.com/docker/machine/drivers/vmwarevcloudair"
|
||||||
_ "github.com/docker/machine/drivers/vmwarevsphere"
|
//_ "github.com/docker/machine/drivers/vmwarevsphere"
|
||||||
"github.com/docker/machine/state"
|
"github.com/docker/machine/state"
|
||||||
"github.com/docker/machine/utils"
|
"github.com/docker/machine/utils"
|
||||||
)
|
)
|
||||||
|
@ -554,9 +554,9 @@ func cmdSsh(c *cli.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.Args()) <= 1 {
|
if len(c.Args()) <= 1 {
|
||||||
sshCmd, err = host.Driver.GetSSHCommand()
|
sshCmd, err = host.GetSSHCommand()
|
||||||
} else {
|
} else {
|
||||||
sshCmd, err = host.Driver.GetSSHCommand(c.Args()[1:]...)
|
sshCmd, err = host.GetSSHCommand(c.Args()[1:]...)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -578,7 +578,7 @@ func machineCommand(actionName string, machine *Host, errorChan chan<- error) {
|
||||||
"stop": machine.Driver.Stop,
|
"stop": machine.Driver.Stop,
|
||||||
"restart": machine.Driver.Restart,
|
"restart": machine.Driver.Restart,
|
||||||
"kill": machine.Driver.Kill,
|
"kill": machine.Driver.Kill,
|
||||||
"upgrade": machine.Driver.Upgrade,
|
"upgrade": machine.Upgrade,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("command=%s machine=%s", actionName, machine.Name)
|
log.Debugf("command=%s machine=%s", actionName, machine.Name)
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
drivers "github.com/docker/machine/drivers"
|
drivers "github.com/docker/machine/drivers"
|
||||||
|
"github.com/docker/machine/hypervisor"
|
||||||
"github.com/docker/machine/state"
|
"github.com/docker/machine/state"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,6 +24,14 @@ func (d *FakeDriver) DriverName() string {
|
||||||
return "fakedriver"
|
return "fakedriver"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) AuthorizePort(ports []*drivers.Port) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) DeauthorizePort(ports []*drivers.Port) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *FakeDriver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
func (d *FakeDriver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -31,10 +40,34 @@ func (d *FakeDriver) GetURL() (string, error) {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) GetMachineName() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) GetHypervisorType() hypervisor.HypervisorType {
|
||||||
|
return hypervisor.None
|
||||||
|
}
|
||||||
|
|
||||||
func (d *FakeDriver) GetIP() (string, error) {
|
func (d *FakeDriver) GetIP() (string, error) {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) GetSSHAddress() (string, error) {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) GetSSHKeyPath() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) GetSSHPort() (int, error) {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *FakeDriver) GetSSHUsername() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (d *FakeDriver) GetState() (state.State, error) {
|
func (d *FakeDriver) GetState() (state.State, error) {
|
||||||
return d.MockState, nil
|
return d.MockState, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue