Skip to content

Commit

Permalink
[supervisor] improve error message around user group and uid
Browse files Browse the repository at this point in the history
  • Loading branch information
sagor999 authored and roboquat committed Jun 2, 2022
1 parent b675fb7 commit 12a6979
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/supervisor/pkg/supervisor/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func hasGroup(name string, gid int) (bool, error) {
}
if grpByID == nil && grpByName != nil {
// a group with this name already exists, but has a different GID
return true, xerrors.Errorf("group named %s exists but uses different GID %s", name, grpByName.Gid)
return true, xerrors.Errorf("group named %s exists but uses different GID %s, should be: %d", name, grpByName.Gid, gitpodGID)
}

// group exists and all is well
Expand Down Expand Up @@ -127,7 +127,7 @@ func hasUser(u *user.User) (bool, error) {
}
if userByID == nil && userByName != nil {
// a user with this name already exists, but has a different GID
return true, xerrors.Errorf("user named %s exists but uses different UID %s", u.Username, userByName.Uid)
return true, xerrors.Errorf("user named %s exists but uses different UID %s, should be: %d", u.Username, userByName.Uid, gitpodUID)
}

// at this point it doesn't matter if we use userByID or byName - they're likely the same
Expand Down
4 changes: 2 additions & 2 deletions components/supervisor/pkg/supervisor/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestHasUser(t *testing.T) {
},
Expectation: Expectation{
Exists: true,
Error: "user named gitpod exists but uses different UID 1000",
Error: "user named gitpod exists but uses different UID 1000, should be: 33333",
},
},
{
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestHasGroup(t *testing.T) {
},
Expectation: Expectation{
Exists: true,
Error: "group named gitpod exists but uses different GID 1000",
Error: "group named gitpod exists but uses different GID 1000, should be: 33333",
},
},
{
Expand Down

0 comments on commit 12a6979

Please sign in to comment.