Download a script from a remote location and execute the script locally. The script can be located on the salt master file server or on an HTTP/FTP server. The script will be executed directly, so it can be written in any available programming language. :param str source:
(
source,
args=None,
cwd=None,
stdin=None,
runas=None,
group=None,
shell=None,
python_shell=None,
env=None,
template=None,
umask=None,
output_encoding=None,
output_loglevel="debug",
log_callback=None,
hide_output=False,
timeout=None,
reset_system_locale=True,
saltenv="base",
use_vt=False,
bg=False,
password=None,
success_retcodes=None,
success_stdout=None,
success_stderr=None,
**kwargs,
)
| 27 | |
| 28 | |
| 29 | def script( |
| 30 | source, |
| 31 | args=None, |
| 32 | cwd=None, |
| 33 | stdin=None, |
| 34 | runas=None, |
| 35 | group=None, |
| 36 | shell=None, |
| 37 | python_shell=None, |
| 38 | env=None, |
| 39 | template=None, |
| 40 | umask=None, |
| 41 | output_encoding=None, |
| 42 | output_loglevel="debug", |
| 43 | log_callback=None, |
| 44 | hide_output=False, |
| 45 | timeout=None, |
| 46 | reset_system_locale=True, |
| 47 | saltenv="base", |
| 48 | use_vt=False, |
| 49 | bg=False, |
| 50 | password=None, |
| 51 | success_retcodes=None, |
| 52 | success_stdout=None, |
| 53 | success_stderr=None, |
| 54 | **kwargs, |
| 55 | ): |
| 56 | """ |
| 57 | Download a script from a remote location and execute the script locally. |
| 58 | The script can be located on the salt master file server or on an HTTP/FTP |
| 59 | server. |
| 60 | |
| 61 | The script will be executed directly, so it can be written in any available |
| 62 | programming language. |
| 63 | |
| 64 | :param str source: The location of the script to download. If the file is |
| 65 | located on the master in the directory named spam, and is called eggs, |
| 66 | the source string is salt://spam/eggs |
| 67 | |
| 68 | :param str args: String of command line args to pass to the script. Only |
| 69 | used if no args are specified as part of the `name` argument. To pass a |
| 70 | string containing spaces in YAML, you will need to doubly-quote it: |
| 71 | |
| 72 | .. code-block:: bash |
| 73 | |
| 74 | salt myminion cmd.script salt://foo.sh "arg1 'arg two' arg3" |
| 75 | |
| 76 | :param str cwd: The directory from which to execute the command. Defaults |
| 77 | to the directory returned from Python's tempfile.mkstemp. |
| 78 | |
| 79 | :param str stdin: A string of standard input can be specified for the |
| 80 | command to be run using the ``stdin`` parameter. This can be useful in |
| 81 | cases where sensitive information must be read from standard input. |
| 82 | |
| 83 | :param str runas: Specify an alternate user to run the command. The default |
| 84 | behavior is to run as the user under which Salt is running. If running |
| 85 | on a Windows minion you must also use the ``password`` argument, and |
| 86 | the target user account must be in the Administrators group. |
no test coverage detected