Merge pull request #20683 from baude/applehvsshkeys

Avoid empty SSH keys on applehv
This commit is contained in:
openshift-merge-bot[bot] 2023-11-14 12:57:27 +00:00 committed by GitHub
commit 1d49773bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -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)
}