From ea89eaa1c149a33e92dd0e8316826819384da6e0 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Mon, 13 Nov 2023 13:07:35 -0600 Subject: [PATCH] Avoid empty SSH keys on applehv [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude --- pkg/machine/applehv/machine.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/machine/applehv/machine.go b/pkg/machine/applehv/machine.go index 0b00faea3151..45737296f3ef 100644 --- a/pkg/machine/applehv/machine.go +++ b/pkg/machine/applehv/machine.go @@ -251,6 +251,14 @@ func (m *MacMachine) Init(opts machine.InitOptions) (bool, error) { return false, err } + if len(opts.IgnitionPath) < 1 { + key, err = machine.CreateSSHKeys(m.IdentityPath) + if err != nil { + return false, err + } + callbackFuncs.Add(m.removeSSHKeys) + } + builder := machine.NewIgnitionBuilder(machine.DynamicIgnition{ Name: opts.Username, Key: key, @@ -262,14 +270,6 @@ func (m *MacMachine) Init(opts machine.InitOptions) (bool, error) { Rootful: m.Rootful, }) - if len(opts.IgnitionPath) < 1 { - key, err = machine.CreateSSHKeys(m.IdentityPath) - if err != nil { - return false, err - } - callbackFuncs.Add(m.removeSSHKeys) - } - if len(opts.IgnitionPath) > 0 { return false, builder.BuildWithIgnitionFile(opts.IgnitionPath) }