Allow user to get public key straight up, or URL encoded.
This commit is contained in:
parent
4b649f7ce4
commit
f9d24ccda0
|
@ -66,6 +66,8 @@ func (s *StepSshKeyPair) Run(_ context.Context, state multistep.StateBag) multis
|
|||
|
||||
// If we're in debug mode, output the private key to the working
|
||||
// directory.
|
||||
// TODO: It would be better if the file was 'chmod' before writing
|
||||
// the key to the disk - or if umask was set before creating the file.
|
||||
if s.Debug {
|
||||
ui.Message(fmt.Sprintf("Saving communicator private key for debug purposes: %s", s.DebugKeyPath))
|
||||
f, err := os.Create(s.DebugKeyPath)
|
||||
|
|
|
@ -27,8 +27,13 @@ type bootCommandTemplateData struct {
|
|||
// Name is the VM's name.
|
||||
Name string
|
||||
|
||||
// SSHPublicKey is the URL encoded public key in
|
||||
// authorized_keys format.
|
||||
// EncodedSSHPublicKey is the URL encoded SSH public key in
|
||||
// OpenSSH authorized_keys format. This is safe for usage
|
||||
// on the the kernel command line, or other places that split
|
||||
// on whitespace.
|
||||
EncodedSSHPublicKey string
|
||||
|
||||
// SSHPublicKey is the SSH public key in OpenSSH authorized_keys format.
|
||||
SSHPublicKey string
|
||||
}
|
||||
|
||||
|
@ -67,10 +72,11 @@ func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag)
|
|||
hostIP := "10.0.2.2"
|
||||
common.SetHTTPIP(hostIP)
|
||||
s.Ctx.Data = &bootCommandTemplateData{
|
||||
HTTPIP: hostIP,
|
||||
HTTPPort: httpPort,
|
||||
Name: s.VMName,
|
||||
SSHPublicKey: s.Comm.SSHPublicKeyUrlEncoded(),
|
||||
HTTPIP: hostIP,
|
||||
HTTPPort: httpPort,
|
||||
Name: s.VMName,
|
||||
EncodedSSHPublicKey: s.Comm.SSHPublicKeyUrlEncoded(),
|
||||
SSHPublicKey: string(s.Comm.SSHPublicKey),
|
||||
}
|
||||
|
||||
sendCodes := func(codes []string) error {
|
||||
|
|
Loading…
Reference in New Issue