mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Make "password" an explicit argument, not a kwarg
This commit is contained in:
parent
74143999d3
commit
5c7b9f0341
1 changed files with 52 additions and 30 deletions
|
@ -680,6 +680,7 @@ def run(cmd,
|
|||
saltenv='base',
|
||||
use_vt=False,
|
||||
bg=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
r'''
|
||||
Execute the passed command and return the output as a string
|
||||
|
@ -699,8 +700,8 @@ def run(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -848,7 +849,7 @@ def run(cmd,
|
|||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
use_vt=use_vt,
|
||||
password=kwargs.get('password', None),
|
||||
password=password,
|
||||
bg=bg)
|
||||
|
||||
log_callback = _check_cb(log_callback)
|
||||
|
@ -888,6 +889,7 @@ def shell(cmd,
|
|||
saltenv='base',
|
||||
use_vt=False,
|
||||
bg=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Execute the passed command and return the output as a string.
|
||||
|
@ -906,15 +908,16 @@ def shell(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
:param int shell: Shell to execute under. Defaults to the system default
|
||||
shell.
|
||||
|
||||
:param bool bg: If True, run command in background and do not await or deliver it's results
|
||||
:param bool bg: If True, run command in background and do not await or
|
||||
deliver its results
|
||||
|
||||
:param list env: A list of environment variables to be set prior to
|
||||
execution.
|
||||
|
@ -1053,6 +1056,7 @@ def shell(cmd,
|
|||
use_vt=use_vt,
|
||||
python_shell=python_shell,
|
||||
bg=bg,
|
||||
password=password,
|
||||
**kwargs)
|
||||
|
||||
|
||||
|
@ -1074,6 +1078,7 @@ def run_stdout(cmd,
|
|||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Execute a command, and only return the standard out
|
||||
|
@ -1090,8 +1095,8 @@ def run_stdout(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -1212,6 +1217,7 @@ def run_stdout(cmd,
|
|||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
use_vt=use_vt,
|
||||
password=password,
|
||||
**kwargs)
|
||||
|
||||
log_callback = _check_cb(log_callback)
|
||||
|
@ -1255,6 +1261,7 @@ def run_stderr(cmd,
|
|||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Execute a command and only return the standard error
|
||||
|
@ -1271,8 +1278,8 @@ def run_stderr(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -1394,7 +1401,7 @@ def run_stderr(cmd,
|
|||
saltenv=saltenv,
|
||||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
password=kwargs.get('password', None))
|
||||
password=password)
|
||||
|
||||
log_callback = _check_cb(log_callback)
|
||||
|
||||
|
@ -1438,6 +1445,7 @@ def run_all(cmd,
|
|||
saltenv='base',
|
||||
use_vt=False,
|
||||
redirect_stderr=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Execute the passed command and return a dict of return data
|
||||
|
@ -1454,8 +1462,8 @@ def run_all(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -1587,7 +1595,7 @@ def run_all(cmd,
|
|||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
use_vt=use_vt,
|
||||
password=kwargs.get('password', None))
|
||||
password=password)
|
||||
|
||||
log_callback = _check_cb(log_callback)
|
||||
|
||||
|
@ -1629,6 +1637,7 @@ def retcode(cmd,
|
|||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Execute a shell command and return the command's return code.
|
||||
|
@ -1645,8 +1654,8 @@ def retcode(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -1770,7 +1779,7 @@ def retcode(cmd,
|
|||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
use_vt=use_vt,
|
||||
password=kwargs.get('password', None))
|
||||
password=password)
|
||||
|
||||
log_callback = _check_cb(log_callback)
|
||||
|
||||
|
@ -1807,6 +1816,7 @@ def _retcode_quiet(cmd,
|
|||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Helper for running commands quietly for minion startup.
|
||||
|
@ -1829,6 +1839,7 @@ def _retcode_quiet(cmd,
|
|||
ignore_retcode=ignore_retcode,
|
||||
saltenv=saltenv,
|
||||
use_vt=use_vt,
|
||||
password=password,
|
||||
**kwargs)
|
||||
|
||||
|
||||
|
@ -1851,6 +1862,7 @@ def script(source,
|
|||
saltenv='base',
|
||||
use_vt=False,
|
||||
bg=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Download a script from a remote location and execute the script locally.
|
||||
|
@ -1879,8 +1891,8 @@ def script(source,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -2038,8 +2050,8 @@ def script(source,
|
|||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
use_vt=use_vt,
|
||||
password=kwargs.get('password', None),
|
||||
bg=bg)
|
||||
bg=bg,
|
||||
password=password)
|
||||
_cleanup_tempfile(path)
|
||||
return ret
|
||||
|
||||
|
@ -2061,6 +2073,7 @@ def script_retcode(source,
|
|||
output_loglevel='debug',
|
||||
log_callback=None,
|
||||
use_vt=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Download a script from a remote location and execute the script locally.
|
||||
|
@ -2093,8 +2106,8 @@ def script_retcode(source,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -2201,6 +2214,7 @@ def script_retcode(source,
|
|||
output_loglevel=output_loglevel,
|
||||
log_callback=log_callback,
|
||||
use_vt=use_vt,
|
||||
password=password,
|
||||
**kwargs)['retcode']
|
||||
|
||||
|
||||
|
@ -2348,10 +2362,10 @@ def run_chroot(root,
|
|||
This function runs :mod:`cmd.run_all <salt.modules.cmdmod.run_all>` wrapped
|
||||
within a chroot, with dev and proc mounted in the chroot
|
||||
|
||||
root:
|
||||
root
|
||||
Path to the root of the jail to use.
|
||||
|
||||
cmd:
|
||||
cmd
|
||||
The command to run. ex: 'ls -lart /home'
|
||||
|
||||
cwd
|
||||
|
@ -2586,6 +2600,7 @@ def powershell(cmd,
|
|||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Execute the passed PowerShell command and return the output as a string.
|
||||
|
@ -2613,8 +2628,8 @@ def powershell(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Pass a password if you specify runas.
|
||||
This parameter will be ignored for other OS's
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -2727,6 +2742,7 @@ def powershell(cmd,
|
|||
saltenv=saltenv,
|
||||
use_vt=use_vt,
|
||||
python_shell=python_shell,
|
||||
password=password,
|
||||
**kwargs)
|
||||
|
||||
try:
|
||||
|
@ -2749,7 +2765,9 @@ def run_bg(cmd,
|
|||
output_loglevel='debug',
|
||||
log_callback=None,
|
||||
reset_system_locale=True,
|
||||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
password=None,
|
||||
**kwargs):
|
||||
r'''
|
||||
.. versionadded: 2016.3.0
|
||||
|
@ -2771,6 +2789,11 @@ def run_bg(cmd,
|
|||
:param str runas: User to run script as. If running on a Windows minion you
|
||||
must also pass a password
|
||||
|
||||
:param str password: Windows only. Required when specifying ``runas``. This
|
||||
parameter will be ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
:param str shell: Shell to execute under. Defaults to the system default
|
||||
shell.
|
||||
|
||||
|
@ -2896,12 +2919,11 @@ def run_bg(cmd,
|
|||
log_callback=log_callback,
|
||||
timeout=timeout,
|
||||
reset_system_locale=reset_system_locale,
|
||||
# ignore_retcode=ignore_retcode,
|
||||
ignore_retcode=ignore_retcode,
|
||||
saltenv=saltenv,
|
||||
pillarenv=kwargs.get('pillarenv'),
|
||||
pillar_override=kwargs.get('pillar'),
|
||||
# password=kwargs.get('password', None),
|
||||
)
|
||||
password=password)
|
||||
|
||||
return {
|
||||
'pid': res['pid']
|
||||
|
|
Loading…
Add table
Reference in a new issue