Skip to content

Conversation

@achilleas-k
Copy link
Member

@achilleas-k achilleas-k commented Jan 21, 2026

Add a Validate() method for group customizations and call the validator when GetGroups() is called. The validator checks for duplicate names and/or GIDs and returns an error for each duplicate value.

This changes the signature of the method, which is a breaking API change and will need adjustments when the library is updated in images.

We're going to make some changes to the group customization handling,
so let's first move the two (related) customizations to their own file
to keep things tidy.

Move the related tests as well for the same reason.
Add some extra test cases for the simple test before we add validation.
Add a validator for the group customizations.

Create a type for []GroupCustomization so we can add the Validate()
method.  Run the validator when GetGroups() is called.  This changes the
signature of the method, which is a breaking API change and will need
adjustments when the library is updated in images.
Add validation error test cases to TestGetGroups().
@achilleas-k
Copy link
Member Author

This is a follow up from osbuild/images#2146 (comment)

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

SSHKey []SSHKeyCustomization `json:"sshkey,omitempty" toml:"sshkey,omitempty"`
User []UserCustomization `json:"user,omitempty" toml:"user,omitempty"`
Group []GroupCustomization `json:"group,omitempty" toml:"group,omitempty"`
Group GroupsCustomization `json:"group,omitempty" toml:"group,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait what, are you breaking the user-space here?

return users
}

type GroupsCustomization []GroupCustomization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you do not, okay.

@supakeen supakeen added this pull request to the merge queue Jan 21, 2026
Merged via the queue into osbuild:main with commit e5aca42 Jan 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants