allow user to override vagrant authentication by setting ssh_username and ssh_password.
This commit is contained in:
parent
757bd4bed9
commit
06a0db9350
|
@ -36,8 +36,6 @@ func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multi
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
config.Comm.SSHPrivateKeyFile = sshConfig.IdentityFile
|
||||
config.Comm.SSHUsername = sshConfig.User
|
||||
config.Comm.SSHHost = sshConfig.Hostname
|
||||
port, err := strconv.Atoi(sshConfig.Port)
|
||||
if err != nil {
|
||||
|
@ -46,6 +44,14 @@ func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multi
|
|||
}
|
||||
config.Comm.SSHPort = port
|
||||
|
||||
if config.Comm.SSHUsername != "" {
|
||||
// If user has set the username within the communicator, use the
|
||||
// auth provided there.
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
config.Comm.SSHPrivateKeyFile = sshConfig.IdentityFile
|
||||
config.Comm.SSHUsername = sshConfig.User
|
||||
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue