Skip to content

Commit

Permalink
Fix restore of UID
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Oct 21, 2024
1 parent 3ce03f4 commit a4f1794
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/plugins/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ last:x:999:999:Test user for uid:/:/usr/bin/nologin
Expect(foo.HomeDir()).To(Equal("/run/foo"))
Expect(foo.Shell()).To(Equal("/bin/bash"))
Expect(foo.Password()).To(Equal("x"))
// we specifically set this UID()
Expect(foo.UID()).To(Equal(5000))

})
Expand Down
1 change: 1 addition & 0 deletions pkg/schema/loader_cloudinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (cloudInit) Load(source string, s []byte, fs vfs.FS) (*YipConfig, error) {
System: u.System,
NoLogInit: u.NoLogInit,
Shell: u.Shell,
UID: u.UID,
LockPasswd: u.LockPasswd,
}
sshKeys[u.Name] = u.SSHAuthorizedKeys
Expand Down
2 changes: 1 addition & 1 deletion pkg/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ write_files:
owner: "bar"
`)
Expect(len(yipConfig.Stages)).To(Equal(3))
Expect(yipConfig.Stages["boot"][0].Users["bar"].PasswordHash).To(Equal("foo"))
Expect(yipConfig.Stages["boot"][0].Users["bar"].UID).To(Equal("1002"))
Expect(yipConfig.Stages["boot"][0].Users["bar"].PasswordHash).To(Equal("foo"))
Expect(yipConfig.Stages["boot"][0].SSHKeys).To(Equal(map[string][]string{"bar": {"faaapploo", "asdd"}}))
Expect(yipConfig.Stages["boot"][0].Files[0].Path).To(Equal("/foo/bar"))
Expect(yipConfig.Stages["boot"][0].Files[0].Permissions).To(Equal(uint32(0644)))
Expand Down

0 comments on commit a4f1794

Please sign in to comment.