Esempio n. 1
0
func (c *MountCommand) prepareForSSH(sshKey *ssh.SSHKey) error {
	if err := sshKey.PrepareForSSH(c.Options.Name); err != nil {
		if strings.Contains(err.Error(), "user: unknown user") {
			c.printfln(CannotFindSSHUser)
			return fmt.Errorf("Cannot ssh into managed machines. err:%s", err)
		}

		if klientctlerrors.IsMachineNotValidYetErr(err) {
			c.printfln(defaultHealthChecker.CheckAllFailureOrMessagef(MachineNotValidYet))
			return fmt.Errorf("Machine is not valid yet. err:%s", err)
		}

		c.printfln(FailedGetSSHKey)
		return fmt.Errorf("Error getting ssh key. err:%s", err)
	}

	return nil
}
Esempio n. 2
0
func (c *Command) prepareForSSH(machineName string, sshKey *ssh.SSHKey) error {
	if err := sshKey.PrepareForSSH(machineName); err != nil {
		if strings.Contains(err.Error(), "user: unknown user") {
			c.Stdout.Printlnf(errormessages.CannotFindSSHUser)
			return fmt.Errorf("Cannot ssh into managed machines. err:%s", err)
		}

		if klientctlerrors.IsMachineNotValidYetErr(err) {
			c.Stdout.Printlnf(
				c.HealthChecker.CheckAllFailureOrMessagef(errormessages.MachineNotValidYet),
			)
			return fmt.Errorf("Machine is not valid yet. err:%s", err)
		}

		c.Stdout.Printlnf(errormessages.FailedGetSSHKey)
		return fmt.Errorf("Error getting ssh key. err:%s", err)
	}

	return nil
}