コード例 #1
0
ファイル: clm.go プロジェクト: ajoy123/docker-machine
// GetSSHCommand returns a command that will run over SSH on the GCE instance.
func (driver *Driver) GetSSHCommand(args ...string) (*exec.Cmd, error) {
	ip, err := driver.GetIP()
	if err != nil {
		return nil, err
	}
	return ssh.GetSSHCommand(ip, 22, driver.UserName, driver.sshKeyPath, args...), nil
}
コード例 #2
0
ファイル: drivers_ext.go プロジェクト: Aorjoa/Machine-Aiyara
func getSSHCommandWithSSHPassFromDriver(d Driver, args ...string) (*exec.Cmd, error) {
	host, err := d.GetSSHHostname()
	if err != nil {
		return nil, err
	}

	port, err := d.GetSSHPort()
	if err != nil {
		return nil, err
	}

	user := d.GetSSHUsername()
	passwd := ""
	// this is the hack to make it return a password rather than key path
	if d0, ok := d.(interface {
		GetSSHPasswd() string
	}); ok {
		passwd = d0.GetSSHPasswd()
		if passwd == "" {
			keyPath := d.GetSSHKeyPath()
			return ssh.GetSSHCommand(host, port, user, keyPath, args...), nil
		}
	}

	return ssh.GetSSHCommandWithSSHPass(host, port, user, passwd, args...), nil
}
コード例 #3
0
func (c *ComputeUtil) executeCommands(commands []string, ip, sshKeyPath string) error {
	for _, command := range commands {
		cmd := ssh.GetSSHCommand(ip, 22, c.userName, sshKeyPath, command)
		if err := cmd.Run(); err != nil {
			return fmt.Errorf("error executing command: %v %v", command, err)
		}
	}
	return nil
}
コード例 #4
0
ファイル: drivers.go プロジェクト: carriercomm/machine-server
func GetSSHCommandFromDriver(d Driver, args ...string) (*exec.Cmd, error) {
	host, err := d.GetSSHHostname()
	if err != nil {
		return nil, err
	}

	port, err := d.GetSSHPort()
	if err != nil {
		return nil, err
	}

	user := d.GetSSHUsername()
	keyPath := d.GetSSHKeyPath()

	return ssh.GetSSHCommand(host, port, user, keyPath, args...), nil
}
コード例 #5
0
ファイル: azure.go プロジェクト: ajoy123/docker-machine
func (driver *Driver) GetSSHCommand(args ...string) (*exec.Cmd, error) {
	err := driver.setUserSubscription()
	if err != nil {
		return nil, err
	}

	vmState, err := driver.GetState()
	if err != nil {
		return nil, err
	}

	if vmState == state.Stopped {
		return nil, fmt.Errorf("Azure host is stopped. Please start it before using ssh command.")
	}

	return ssh.GetSSHCommand(driver.getHostname(), driver.SSHPort, driver.UserName, driver.sshKeyPath(), args...), nil
}
コード例 #6
0
ファイル: host.go プロジェクト: Aorjoa/Machine-Aiyara
func (h *Host) getSSHCommand(args ...string) (*exec.Cmd, error) {
	addr, err := h.Driver.GetSSHHostname()
	if err != nil {
		return nil, err
	}

	user := h.Driver.GetSSHUsername()

	port, err := h.Driver.GetSSHPort()
	if err != nil {
		return nil, err
	}

	keyPath := h.Driver.GetSSHKeyPath()

	cmd := ssh.GetSSHCommand(addr, port, user, keyPath, args...)
	return cmd, nil
}
コード例 #7
0
ファイル: virtualbox.go プロジェクト: ajoy123/docker-machine
func (d *Driver) GetSSHCommand(args ...string) (*exec.Cmd, error) {
	return ssh.GetSSHCommand("localhost", d.SSHPort, "docker", d.sshKeyPath(), args...), nil
}
コード例 #8
0
ファイル: clm.go プロジェクト: ajoy123/docker-machine
func (d *Driver) GetSSHCommand(args ...string) (*exec.Cmd, error) {
	return ssh.GetSSHCommand(d.IPAddress, 22, "ubuntu", d.sshKeyPath(), args...), nil
}