コード例 #1
0
func (s *RegistrationContext) askSSH(runnerConfig *common.RunnerConfig, serverless bool) {
	runnerConfig.SSH = &ssh.Config{}
	if !serverless {
		if host := s.ask("ssh-host", "Please enter the SSH server address (eg. my.server.com):"); host != "" {
			runnerConfig.SSH.Host = &host
		}
		if port := s.ask("ssh-port", "Please enter the SSH server port (eg. 22):", true); port != "" {
			runnerConfig.SSH.Port = &port
		}
	}
	if user := s.ask("ssh-user", "Please enter the SSH user (eg. root):"); user != "" {
		runnerConfig.SSH.User = &user
	}
	if password := s.ask("ssh-password", "Please enter the SSH password (eg. docker.io):"); password != "" {
		runnerConfig.SSH.Password = &password
	}
}
コード例 #2
0
func (s *RegistrationContext) askSSH(runnerConfig *common.RunnerConfig, serverless bool) {
	runnerConfig.SSH = &ssh.Config{}
	if !serverless {
		if host := s.ask("ssh-host", "Please enter the SSH server address (eg. my.server.com):"); host != "" {
			runnerConfig.SSH.Host = &host
		}
		if port := s.ask("ssh-port", "Please enter the SSH server port (eg. 22):", true); port != "" {
			runnerConfig.SSH.Port = &port
		}
	}
	if user := s.ask("ssh-user", "Please enter the SSH user (eg. root):"); user != "" {
		runnerConfig.SSH.User = &user
	}
	if password := s.ask("ssh-password", "Please enter the SSH password (eg. docker.io):", true); password != "" {
		runnerConfig.SSH.Password = &password
	}
	if identityFile := s.ask("ssh-identity-file", "Please enter path to SSH identity file (eg. /home/user/.ssh/id_rsa):", true); identityFile != "" {
		runnerConfig.SSH.IdentityFile = &identityFile
	}
}