BUGFIX: Argument order pw usermod command.

The argument order of `pw usermod` is[1]:

    pw [-V etcdir] usermod [name|uid]

This was incorrect for the `chhome` function. The updated version is
tested on FreeBSD.

[1]: http://www.freebsd.org/cgi/man.cgi?query=pw&sektion=8
This commit is contained in:
Petar Radosevic 2013-11-25 10:22:58 +01:00
parent ec1f0f46e4
commit 1aff68a361

View File

@ -234,17 +234,15 @@ def chhome(name, home, persist=False):
pre_info = info(name)
if home == pre_info['home']:
return True
cmd = 'pw usermod -d {0} '.format(home)
cmd = 'pw usermod {0} -d {1}'.format(name, home)
if persist:
cmd += ' -m '
cmd += name
__salt__['cmd.run'](cmd)
post_info = info(name)
if post_info['home'] != pre_info['home']:
return post_info['home'] == home
return False
def chgroups(name, groups, append=False):
'''
Change the groups this user belongs to, add append to append the specified