fix: make groupadd optional (group already may exist, like gid 20 from osx)

This commit is contained in:
2025-08-17 23:12:23 -06:00
parent fc819a3861
commit 407c1a1c9b

View File

@@ -224,9 +224,7 @@ class UserManager:
): ):
return False return False
except KeyError: except KeyError:
if not self._run_command(["groupadd", "-g", str(group_id), self.username]): self._run_command(["groupadd", "-g", str(group_id), self.username])
return False
try: try:
existing_user = pwd.getpwnam(self.username) existing_user = pwd.getpwnam(self.username)
if existing_user.pw_uid != user_id or existing_user.pw_gid != group_id: if existing_user.pw_uid != user_id or existing_user.pw_gid != group_id: