Create / use SSH key pairs in vbox builders.

This follows the business logic for creating / using SSH key pairs
in the cloud-type builders (e.g., Amazon EC2).
This commit is contained in:
Stephen Fox 2019-02-03 12:20:52 -05:00
parent 72d1501551
commit cd4ae03324
2 changed files with 12 additions and 0 deletions

View File

@ -222,6 +222,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
HTTPPortMin: b.config.HTTPPortMin, HTTPPortMin: b.config.HTTPPortMin,
HTTPPortMax: b.config.HTTPPortMax, HTTPPortMax: b.config.HTTPPortMax,
}, },
&vboxcommon.StepSshKeyPair{
Debug: b.config.PackerDebug,
DebugKeyPath: fmt.Sprintf("virtualbox_%s.pem", b.config.PackerBuildName),
Comm: &b.config.Comm,
},
new(vboxcommon.StepSuppressMessages), new(vboxcommon.StepSuppressMessages),
new(stepCreateVM), new(stepCreateVM),
new(stepCreateDisk), new(stepCreateDisk),
@ -254,6 +259,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
VMName: b.config.VMName, VMName: b.config.VMName,
Ctx: b.config.ctx, Ctx: b.config.ctx,
GroupInterval: b.config.BootConfig.BootGroupInterval, GroupInterval: b.config.BootConfig.BootGroupInterval,
Comm: &b.config.Comm,
}, },
&communicator.StepConnect{ &communicator.StepConnect{
Config: &b.config.SSHConfig.Comm, Config: &b.config.SSHConfig.Comm,

View File

@ -64,6 +64,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
HTTPPortMin: b.config.HTTPPortMin, HTTPPortMin: b.config.HTTPPortMin,
HTTPPortMax: b.config.HTTPPortMax, HTTPPortMax: b.config.HTTPPortMax,
}, },
&vboxcommon.StepSshKeyPair{
Debug: b.config.PackerDebug,
DebugKeyPath: fmt.Sprintf("virtualbox_%s.pem", b.config.PackerBuildName),
Comm: &b.config.Comm,
},
&vboxcommon.StepDownloadGuestAdditions{ &vboxcommon.StepDownloadGuestAdditions{
GuestAdditionsMode: b.config.GuestAdditionsMode, GuestAdditionsMode: b.config.GuestAdditionsMode,
GuestAdditionsURL: b.config.GuestAdditionsURL, GuestAdditionsURL: b.config.GuestAdditionsURL,
@ -111,6 +116,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
VMName: b.config.VMName, VMName: b.config.VMName,
Ctx: b.config.ctx, Ctx: b.config.ctx,
GroupInterval: b.config.BootConfig.BootGroupInterval, GroupInterval: b.config.BootConfig.BootGroupInterval,
Comm: &b.config.Comm,
}, },
&communicator.StepConnect{ &communicator.StepConnect{
Config: &b.config.SSHConfig.Comm, Config: &b.config.SSHConfig.Comm,