Skip to content

Commit

Permalink
groupadd: user --root instead of -R or -Q
Browse files Browse the repository at this point in the history
In some places of the code gpasswd and usermod are used depending
on the plataform.  One use -Q and other use -R to indicate a
different root parameter.

This patch unify this, using --root parameter.

Partially fix #43131

(cherry picked from commit 27372ee)
  • Loading branch information
aplanas committed Dec 3, 2019
1 parent 0addf75 commit c60fbdb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions salt/modules/groupadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def adduser(name, username, root=None):
else:
cmd = ['gpasswd', '--add', username, name]
if root is not None:
cmd.extend(('-Q', root))
cmd.extend(('--root', root))
else:
cmd = ['usermod', '-G', name, username]
if root is not None:
Expand Down Expand Up @@ -300,7 +300,7 @@ def deluser(name, username, root=None):
else:
cmd = ['gpasswd', '--del', username, name]
if root is not None:
cmd.extend(('-R', root))
cmd.extend(('--root', root))
retcode = __salt__['cmd.retcode'](cmd, python_shell=False)
elif __grains__['kernel'] == 'OpenBSD':
out = __salt__['cmd.run_stdout']('id -Gn {0}'.format(username),
Expand Down Expand Up @@ -352,7 +352,7 @@ def members(name, members_list, root=None):
else:
cmd = ['gpasswd', '--members', members_list, name]
if root is not None:
cmd.extend(('-R', root))
cmd.extend(('--root', root))
retcode = __salt__['cmd.retcode'](cmd, python_shell=False)
elif __grains__['kernel'] == 'OpenBSD':
retcode = 1
Expand Down

0 comments on commit c60fbdb

Please sign in to comment.