Merge pull request #326 from pas256/patch-2
Fixing append when user already in desired groups
This commit is contained in:
commit
95069b7ee3
1 changed files with 4 additions and 1 deletions
|
@ -162,7 +162,10 @@ def user_mod(user, **kwargs):
|
||||||
elif key == 'append':
|
elif key == 'append':
|
||||||
if kwargs[key] is not None and kwargs[key] == 'yes':
|
if kwargs[key] is not None and kwargs[key] == 'yes':
|
||||||
if 'groups' in kwargs and kwargs['groups'] is not None:
|
if 'groups' in kwargs and kwargs['groups'] is not None:
|
||||||
cmd.append('-a')
|
defined_groups = kwargs['groups'].split(',')
|
||||||
|
existing_groups = user_group_membership(user)
|
||||||
|
if sorted(defined_groups) != sorted(existing_groups):
|
||||||
|
cmd.append('-a')
|
||||||
# skip if no changes to be made
|
# skip if no changes to be made
|
||||||
if len(cmd) == 1:
|
if len(cmd) == 1:
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in a new issue