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. The script can also
(
source,
args=None,
cwd=None,
stdin=None,
runas=None,
group=None,
shell=None,
python_shell=None,
env=None,
template="jinja",
umask=None,
timeout=None,
reset_system_locale=True,
saltenv="base",
output_encoding=None,
output_loglevel="debug",
log_callback=None,
use_vt=False,
password=None,
success_retcodes=None,
success_stdout=None,
success_stderr=None,
**kwargs,
)
| 313 | |
| 314 | |
| 315 | def script_retcode( |
| 316 | source, |
| 317 | args=None, |
| 318 | cwd=None, |
| 319 | stdin=None, |
| 320 | runas=None, |
| 321 | group=None, |
| 322 | shell=None, |
| 323 | python_shell=None, |
| 324 | env=None, |
| 325 | template="jinja", |
| 326 | umask=None, |
| 327 | timeout=None, |
| 328 | reset_system_locale=True, |
| 329 | saltenv="base", |
| 330 | output_encoding=None, |
| 331 | output_loglevel="debug", |
| 332 | log_callback=None, |
| 333 | use_vt=False, |
| 334 | password=None, |
| 335 | success_retcodes=None, |
| 336 | success_stdout=None, |
| 337 | success_stderr=None, |
| 338 | **kwargs, |
| 339 | ): |
| 340 | """ |
| 341 | Download a script from a remote location and execute the script locally. |
| 342 | The script can be located on the salt master file server or on an HTTP/FTP |
| 343 | server. |
| 344 | |
| 345 | The script will be executed directly, so it can be written in any available |
| 346 | programming language. |
| 347 | |
| 348 | The script can also be formatted as a template, the default is jinja. |
| 349 | |
| 350 | Only evaluate the script return code and do not block for terminal output |
| 351 | |
| 352 | :param str source: The location of the script to download. If the file is |
| 353 | located on the master in the directory named spam, and is called eggs, |
| 354 | the source string is salt://spam/eggs |
| 355 | |
| 356 | :param str args: String of command line args to pass to the script. Only |
| 357 | used if no args are specified as part of the `name` argument. To pass a |
| 358 | string containing spaces in YAML, you will need to doubly-quote it: |
| 359 | "arg1 'arg two' arg3" |
| 360 | |
| 361 | :param str cwd: The directory from which to execute the command. Defaults |
| 362 | to the home directory of the user specified by ``runas`` (or the user |
| 363 | under which Salt is running if ``runas`` is not specified). |
| 364 | |
| 365 | :param str stdin: A string of standard input can be specified for the |
| 366 | command to be run using the ``stdin`` parameter. This can be useful in |
| 367 | cases where sensitive information must be read from standard input. |
| 368 | |
| 369 | :param str runas: Specify an alternate user to run the command. The default |
| 370 | behavior is to run as the user under which Salt is running. If running |
| 371 | on a Windows minion you must also use the ``password`` argument, and |
| 372 | the target user account must be in the Administrators group. |