distro/rhel86,rhel90: don't write keys for ostree commits in user stage
Writing the key to the user home directory has no effect for ostree commits. Instead we write them using a fist-boot service. In certain situations (e.g., when building an upgrade commit against an existing parent), the user's home directory might not exist during the build and the user key creation fails in the users stage, so let's remove it entirely to avoid the issue.
This commit is contained in:
parent
be382ecef8
commit
129536dad0
2 changed files with 41 additions and 2 deletions
|
|
@ -418,9 +418,29 @@ func osPipeline(t *imageType,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.AddStage(osbuild.NewUsersStage(userOptions))
|
||||
|
||||
if t.rpmOstree {
|
||||
// for ostree, writing the key during user creation is redundant
|
||||
// and can cause issues so create users without keys and write them
|
||||
// on first boot
|
||||
userOptionsSansKeys := new(osbuild.UsersStageOptions)
|
||||
userOptionsSansKeys.Users = make(map[string]osbuild.UsersStageOptionsUser, len(userOptions.Users))
|
||||
for name, options := range userOptions.Users {
|
||||
userOptionsSansKeys.Users[name] = osbuild.UsersStageOptionsUser{
|
||||
UID: options.UID,
|
||||
GID: options.GID,
|
||||
Groups: options.Groups,
|
||||
Description: options.Description,
|
||||
Home: options.Home,
|
||||
Shell: options.Shell,
|
||||
Password: options.Password,
|
||||
Key: nil,
|
||||
}
|
||||
}
|
||||
p.AddStage(osbuild.NewUsersStage(userOptionsSansKeys))
|
||||
p.AddStage(osbuild.NewFirstBootStage(usersFirstBootOptions(userOptions)))
|
||||
} else {
|
||||
p.AddStage(osbuild.NewUsersStage(userOptions))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -409,9 +409,28 @@ func osPipeline(t *imageType,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.AddStage(osbuild.NewUsersStage(userOptions))
|
||||
if t.rpmOstree {
|
||||
// for ostree, writing the key during user creation is redundant
|
||||
// and can cause issues so create users without keys and write them
|
||||
// on first boot
|
||||
userOptionsSansKeys := new(osbuild.UsersStageOptions)
|
||||
userOptionsSansKeys.Users = make(map[string]osbuild.UsersStageOptionsUser, len(userOptions.Users))
|
||||
for name, options := range userOptions.Users {
|
||||
userOptionsSansKeys.Users[name] = osbuild.UsersStageOptionsUser{
|
||||
UID: options.UID,
|
||||
GID: options.GID,
|
||||
Groups: options.Groups,
|
||||
Description: options.Description,
|
||||
Home: options.Home,
|
||||
Shell: options.Shell,
|
||||
Password: options.Password,
|
||||
Key: nil,
|
||||
}
|
||||
}
|
||||
p.AddStage(osbuild.NewUsersStage(userOptionsSansKeys))
|
||||
p.AddStage(osbuild.NewFirstBootStage(usersFirstBootOptions(userOptions)))
|
||||
} else {
|
||||
p.AddStage(osbuild.NewUsersStage(userOptions))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue