mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Avoid traceback in mac_user.py when user.chhome is invoked from a user state (#35901)
* mac_user.py: Avoid traceback in chhome func * Add warning about lack of Windows/Mac support for createhome
This commit is contained in:
parent
2da501071e
commit
678f10cf8b
@ -272,7 +272,7 @@ def chshell(name, shell):
|
||||
return info(name).get('shell') == shell
|
||||
|
||||
|
||||
def chhome(name, home):
|
||||
def chhome(name, home, **kwargs):
|
||||
'''
|
||||
Change the home directory of the user
|
||||
|
||||
@ -282,6 +282,13 @@ def chhome(name, home):
|
||||
|
||||
salt '*' user.chhome foo /Users/foo
|
||||
'''
|
||||
kwargs = salt.utils.clean_kwargs(**kwargs)
|
||||
persist = kwargs.pop('persist', False)
|
||||
if kwargs:
|
||||
salt.utils.invalid_kwargs(kwargs)
|
||||
if persist:
|
||||
log.info('Ignoring unsupported \'persist\' argument to user.chhome')
|
||||
|
||||
pre_info = info(name)
|
||||
if not pre_info:
|
||||
raise CommandExecutionError('User {0!r} does not exist'.format(name))
|
||||
|
@ -259,10 +259,15 @@ def present(name,
|
||||
This also the location of the home directory to create if createhome is
|
||||
set to True.
|
||||
|
||||
createhome
|
||||
If False, the home directory will not be created if it doesn't exist.
|
||||
Please note that directories leading up to the home directory
|
||||
will NOT be created, Default is ``True``.
|
||||
createhome : True
|
||||
If set to ``False``, the home directory will not be created if it
|
||||
doesn't already exist.
|
||||
|
||||
.. warning::
|
||||
Not supported on Windows or Mac OS.
|
||||
|
||||
Additionally, parent directories will *not* be created. The parent
|
||||
directory for ``home`` must already exist.
|
||||
|
||||
password
|
||||
A password hash to set for the user. This field is only supported on
|
||||
|
Loading…
Reference in New Issue
Block a user