mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-04 07:30:20 -07:00
Check if the gid is set
This commit is contained in:
parent
fedd1bed1f
commit
ac41e7c669
1 changed files with 5 additions and 3 deletions
|
@ -273,6 +273,7 @@ class DarwinGroup(Group):
|
||||||
def group_add(self, **kwargs):
|
def group_add(self, **kwargs):
|
||||||
cmd = [self.module.get_bin_path('dseditgroup', True)]
|
cmd = [self.module.get_bin_path('dseditgroup', True)]
|
||||||
cmd += [ '-o', 'create' ]
|
cmd += [ '-o', 'create' ]
|
||||||
|
if self.gid is not None:
|
||||||
cmd += [ '-i', self.gid ]
|
cmd += [ '-i', self.gid ]
|
||||||
cmd += [ '-L', self.name ]
|
cmd += [ '-L', self.name ]
|
||||||
(rc, out, err) = self.execute_command(cmd)
|
(rc, out, err) = self.execute_command(cmd)
|
||||||
|
@ -285,12 +286,13 @@ class DarwinGroup(Group):
|
||||||
(rc, out, err) = self.execute_command(cmd)
|
(rc, out, err) = self.execute_command(cmd)
|
||||||
return (rc, out, err)
|
return (rc, out, err)
|
||||||
|
|
||||||
def group_mod(self):
|
def group_mod(self, gid=None):
|
||||||
info = self.group_info()
|
info = self.group_info()
|
||||||
if self.gid is not None and int(self.gid) != info[2]:
|
if self.gid is not None and int(self.gid) != info[2]:
|
||||||
cmd = [self.module.get_bin_path('dseditgroup', True)]
|
cmd = [self.module.get_bin_path('dseditgroup', True)]
|
||||||
cmd += [ '-o', 'edit' ]
|
cmd += [ '-o', 'edit' ]
|
||||||
cmd += [ '-i', self.gid ]
|
if gid is not None:
|
||||||
|
cmd += [ '-i', gid ]
|
||||||
cmd += [ '-L', self.name ]
|
cmd += [ '-L', self.name ]
|
||||||
(rc, out, err) = self.execute_command(cmd)
|
(rc, out, err) = self.execute_command(cmd)
|
||||||
return (rc, out, err)
|
return (rc, out, err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue