MCPcopy Create free account
hub / github.com/saltstack/salt / script

Function script

salt/modules/cmdmod.py:2845–3220  ·  view source on GitHub ↗

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=DEFAULT_SHELL,
    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=None,
    use_vt=False,
    bg=False,
    password=None,
    success_retcodes=None,
    success_stdout=None,
    success_stderr=None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

2843
2844
2845def script(
2846 source,
2847 args=None,
2848 cwd=None,
2849 stdin=None,
2850 runas=None,
2851 group=None,
2852 shell=DEFAULT_SHELL,
2853 python_shell=None,
2854 env=None,
2855 template=None,
2856 umask=None,
2857 output_encoding=None,
2858 output_loglevel="debug",
2859 log_callback=None,
2860 hide_output=False,
2861 timeout=None,
2862 reset_system_locale=True,
2863 saltenv=None,
2864 use_vt=False,
2865 bg=False,
2866 password=None,
2867 success_retcodes=None,
2868 success_stdout=None,
2869 success_stderr=None,
2870 **kwargs,
2871):
2872 """
2873 Download a script from a remote location and execute the script locally.
2874 The script can be located on the salt master file server or on an HTTP/FTP
2875 server.
2876
2877 The script will be executed directly, so it can be written in any available
2878 programming language.
2879
2880 :param str source: The location of the script to download. If the file is
2881 located on the master in the directory named spam, and is called eggs,
2882 the source string is salt://spam/eggs
2883
2884 :param str args: String of command line args to pass to the script. Only
2885 used if no args are specified as part of the `name` argument. To pass a
2886 string containing spaces in YAML, you will need to doubly-quote it.
2887 Additionally, if you need to pass falsey values (e.g., "0", "", "False"),
2888 you should doubly-quote them to ensure they are correctly interpreted:
2889
2890 .. code-block:: bash
2891
2892 salt myminion cmd.script salt://foo.sh "arg1 'arg two' arg3"
2893 salt myminion cmd.script salt://foo.sh "''0''"
2894 salt myminion cmd.script salt://foo.sh "''False''"
2895
2896 :param str cwd: The directory from which to execute the command. Defaults
2897 to the directory returned from Python's tempfile.mkstemp.
2898
2899 :param str stdin: A string of standard input can be specified for the
2900 command to be run using the ``stdin`` parameter. This can be useful in
2901 cases where sensitive information must be read from standard input.
2902

Callers 1

script_retcodeFunction · 0.70

Calls 8

_python_shell_defaultFunction · 0.85
warningMethod · 0.80
_gather_pillarFunction · 0.70
_cleanup_tempfileFunction · 0.70
_runFunction · 0.70
getMethod · 0.45
popMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected