Skip to content

Commit

Permalink
pkg/blueprint: add ExpireDate to users
Browse files Browse the repository at this point in the history
  • Loading branch information
andremarianiello authored and bcl committed Mar 21, 2024
1 parent a8d116c commit a5beebe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/blueprint/customizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type UserCustomization struct {
Groups []string `json:"groups,omitempty" toml:"groups,omitempty"`
UID *int `json:"uid,omitempty" toml:"uid,omitempty"`
GID *int `json:"gid,omitempty" toml:"gid,omitempty"`
ExpireDate *int `json:"expiredate,omitempty" toml:"expiredate,omitempty"`
}

type GroupCustomization struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/blueprint/customizations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func TestGetUsers(t *testing.T) {
}
UID := 123
GID := 321
ExpireDate := 12345

expectedUsers := []UserCustomization{
{
Expand All @@ -115,6 +116,7 @@ func TestGetUsers(t *testing.T) {
Groups: Groups,
UID: &UID,
GID: &GID,
ExpireDate: &ExpireDate,
},
}

Expand Down
1 change: 1 addition & 0 deletions pkg/customizations/users/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type User struct {
Groups []string
UID *int
GID *int
ExpireDate *int
}

type Group struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/osbuild/users_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type UsersStageOptionsUser struct {
Shell *string `json:"shell,omitempty"`
Password *string `json:"password,omitempty"`
Key *string `json:"key,omitempty"`
ExpireDate *int `json:"expiredate,omitempty"`
}

func NewUsersStage(options *UsersStageOptions) *Stage {
Expand Down Expand Up @@ -60,6 +61,7 @@ func NewUsersStageOptions(userCustomizations []users.User, omitKey bool) (*Users
Shell: uc.Shell,
Password: uc.Password,
Key: nil,
ExpireDate: uc.ExpireDate,
}
if !omitKey {
user.Key = uc.Key
Expand Down

0 comments on commit a5beebe

Please sign in to comment.