Skip to content

Commit

Permalink
Merge pull request containers#20683 from baude/applehvsshkeys
Browse files Browse the repository at this point in the history
Avoid empty SSH keys on applehv
  • Loading branch information
openshift-merge-bot[bot] committed Nov 14, 2023
2 parents 540ade0 + ea89eaa commit 1d49773
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/machine/applehv/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
Expand Down

0 comments on commit 1d49773

Please sign in to comment.