blueprint: sshkey to users in images blueprint conversion

The sshkey customization in osbuild/images has been dropped.  In
osbuild-composer we maintain it for backwards compatibility, converting
each to a user customization, which is a superset of the sshkey.
This commit is contained in:
Achilleas Koutsou 2024-09-13 16:16:54 +02:00 committed by Tomáš Hozza
parent 1f21f8e217
commit ec01c6908b
2 changed files with 5 additions and 14 deletions

View file

@ -292,14 +292,7 @@ func Convert(bp Blueprint) iblueprint.Blueprint {
ikernel := iblueprint.KernelCustomization(*kernel)
customizations.Kernel = &ikernel
}
if sshkeys := c.SSHKey; sshkeys != nil {
isshkeys := make([]iblueprint.SSHKeyCustomization, len(sshkeys))
for idx := range sshkeys {
isshkeys[idx] = iblueprint.SSHKeyCustomization(sshkeys[idx])
}
customizations.SSHKey = isshkeys
}
if users := c.User; users != nil {
if users := c.GetUsers(); users != nil { // contains both user customizations and converted sshkey customizations
iusers := make([]iblueprint.UserCustomization, len(users))
for idx := range users {
iusers[idx] = iblueprint.UserCustomization(users[idx])

View file

@ -236,13 +236,11 @@ func TestConvert(t *testing.T) {
Name: "kernel-name",
Append: "kernel-append",
},
SSHKey: []iblueprint.SSHKeyCustomization{
{
User: "ssh-user",
Key: "ssh-key",
},
},
User: []iblueprint.UserCustomization{
{
Name: "ssh-user", // converted from sshkey
Key: common.ToPtr("ssh-key"),
},
{
Name: "user-name",
Description: common.ToPtr("user-desc"),