From 8bad6d4eacd22fb4c28f85b9c2fb8866d248ee7a Mon Sep 17 00:00:00 2001 From: Sam Hentschel Date: Thu, 21 Nov 2024 00:31:46 -0500 Subject: [PATCH] [feat] add temporary SSH key generation The documentation for the `proxmox-iso` plugin stated that when using the SSH communicator a temporary keypair will be generate if no other authorization methods are provided. This operation did not take place and this commit aims to fix that using the SSH Communicator's 'StepSSHKeyGen' step. --- builder/proxmox/common/builder.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/builder/proxmox/common/builder.go b/builder/proxmox/common/builder.go index a10fd691..ae3d0801 100644 --- a/builder/proxmox/common/builder.go +++ b/builder/proxmox/common/builder.go @@ -67,7 +67,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook, }, &commonsteps.StepProvision{}, &commonsteps.StepCleanupTempKeys{ - Comm: &b.config.Comm, + Comm: comm, }, &stepRemoveCloudInitDrive{}, &stepConvertToTemplate{}, @@ -75,6 +75,14 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook, &stepSuccess{}, } preSteps := b.preSteps + if (*comm).Type == "ssh" { + preSteps = append(preSteps, + &communicator.StepSSHKeyGen{ + CommConf: comm, + SSHTemporaryKeyPair: (*comm).SSHTemporaryKeyPair, + }, + ) + } for idx := range b.config.ISOs { if b.config.ISOs[idx].ISODownloadPVE { preSteps = append(preSteps,