From ac41e7c66919e7d46c55936b5dfa2c5d6ccdeadb Mon Sep 17 00:00:00 2001 From: bambou Date: Sat, 18 Jul 2015 17:53:02 +0200 Subject: [PATCH] Check if the gid is set --- lib/ansible/modules/system/group.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/system/group.py b/lib/ansible/modules/system/group.py index d97dd2176ac..ab542d9bc47 100755 --- a/lib/ansible/modules/system/group.py +++ b/lib/ansible/modules/system/group.py @@ -273,7 +273,8 @@ class DarwinGroup(Group): def group_add(self, **kwargs): cmd = [self.module.get_bin_path('dseditgroup', True)] cmd += [ '-o', 'create' ] - cmd += [ '-i', self.gid ] + if self.gid is not None: + cmd += [ '-i', self.gid ] cmd += [ '-L', self.name ] (rc, out, err) = self.execute_command(cmd) return (rc, out, err) @@ -285,12 +286,13 @@ class DarwinGroup(Group): (rc, out, err) = self.execute_command(cmd) return (rc, out, err) - def group_mod(self): + def group_mod(self, gid=None): info = self.group_info() if self.gid is not None and int(self.gid) != info[2]: cmd = [self.module.get_bin_path('dseditgroup', True)] cmd += [ '-o', 'edit' ] - cmd += [ '-i', self.gid ] + if gid is not None: + cmd += [ '-i', gid ] cmd += [ '-L', self.name ] (rc, out, err) = self.execute_command(cmd) return (rc, out, err)