Skip to content

Commit

Permalink
cloudapi/v2: tweak customizations
Browse files Browse the repository at this point in the history
Fix verbiage of groups customization, fields which accept an array
should be plural.

Remove the sshkey customization, sshkeys are merged into user
customizations anyway, so users should use the "users" customization
instead.

Since these customizations aren't in use yet, this edit should be fine.

See #3716
  • Loading branch information
croissanne committed Dec 8, 2023
1 parent 1afe7d2 commit bfad6d5
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 178 deletions.
15 changes: 2 additions & 13 deletions internal/cloudapi/v2/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,9 @@ func (request *ComposeRequest) GetBlueprintWithCustomizations() (blueprint.Bluep
bp.Customizations.Kernel = kernel
}

if request.Customizations.Sshkey != nil {
keys := []blueprint.SSHKeyCustomization{}
for _, key := range *request.Customizations.Sshkey {
keys = append(keys, blueprint.SSHKeyCustomization{
User: key.User,
Key: key.Key,
})
}
bp.Customizations.SSHKey = keys
}

if request.Customizations.Group != nil {
if request.Customizations.Groups != nil {
groups := []blueprint.GroupCustomization{}
for _, group := range *request.Customizations.Group {
for _, group := range *request.Customizations.Groups {
groups = append(groups, blueprint.GroupCustomization{
Name: group.Name,
GID: group.Gid,
Expand Down
12 changes: 0 additions & 12 deletions internal/cloudapi/v2/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ func TestGetBlueprintWithCustomizations(t *testing.T) {
Url: "provisioning-url.local",
},
},
Sshkey: &[]SSHKey{
{
Key: "key",
User: "user",
},
},
Timezone: &Timezone{
Timezone: common.ToPtr("US/Eastern"),
Ntpservers: common.ToPtr([]string{
Expand Down Expand Up @@ -226,12 +220,6 @@ func TestGetBlueprintWithCustomizations(t *testing.T) {
ProvisioningURL: "provisioning-url.local",
},
},
SSHKey: []blueprint.SSHKeyCustomization{
{
Key: "key",
User: "user",
},
},
Timezone: &blueprint.TimezoneCustomization{
Timezone: common.ToPtr("US/Eastern"),
NTPServers: []string{
Expand Down
Loading

0 comments on commit bfad6d5

Please sign in to comment.