Execute the passed command and return a dict of return data :param str cmd: The command to run. ex: ``ls -lart /home`` :param str cwd: The directory from which to execute the command. Defaults to the home directory of the user specified by ``runas`` (or the user under
(
cmd,
cwd=None,
stdin=None,
runas=None,
group=None,
shell=DEFAULT_SHELL,
python_shell=None,
env=None,
clean_env=False,
template=None,
rstrip=True,
umask=None,
output_encoding=None,
output_loglevel="debug",
log_callback=None,
hide_output=False,
timeout=None,
reset_system_locale=True,
ignore_retcode=False,
saltenv=None,
use_vt=False,
redirect_stderr=False,
password=None,
encoded_cmd=False,
prepend_path=None,
success_retcodes=None,
success_stdout=None,
success_stderr=None,
**kwargs,
)
| 2260 | |
| 2261 | |
| 2262 | def run_all( |
| 2263 | cmd, |
| 2264 | cwd=None, |
| 2265 | stdin=None, |
| 2266 | runas=None, |
| 2267 | group=None, |
| 2268 | shell=DEFAULT_SHELL, |
| 2269 | python_shell=None, |
| 2270 | env=None, |
| 2271 | clean_env=False, |
| 2272 | template=None, |
| 2273 | rstrip=True, |
| 2274 | umask=None, |
| 2275 | output_encoding=None, |
| 2276 | output_loglevel="debug", |
| 2277 | log_callback=None, |
| 2278 | hide_output=False, |
| 2279 | timeout=None, |
| 2280 | reset_system_locale=True, |
| 2281 | ignore_retcode=False, |
| 2282 | saltenv=None, |
| 2283 | use_vt=False, |
| 2284 | redirect_stderr=False, |
| 2285 | password=None, |
| 2286 | encoded_cmd=False, |
| 2287 | prepend_path=None, |
| 2288 | success_retcodes=None, |
| 2289 | success_stdout=None, |
| 2290 | success_stderr=None, |
| 2291 | **kwargs, |
| 2292 | ): |
| 2293 | """ |
| 2294 | Execute the passed command and return a dict of return data |
| 2295 | |
| 2296 | :param str cmd: The command to run. ex: ``ls -lart /home`` |
| 2297 | |
| 2298 | :param str cwd: The directory from which to execute the command. Defaults |
| 2299 | to the home directory of the user specified by ``runas`` (or the user |
| 2300 | under which Salt is running if ``runas`` is not specified). |
| 2301 | |
| 2302 | :param str stdin: A string of standard input can be specified for the |
| 2303 | command to be run using the ``stdin`` parameter. This can be useful in |
| 2304 | cases where sensitive information must be read from standard input. |
| 2305 | |
| 2306 | :param str runas: Specify an alternate user to run the command. The default |
| 2307 | behavior is to run as the user under which Salt is running. |
| 2308 | |
| 2309 | .. warning:: |
| 2310 | |
| 2311 | For versions 2018.3.3 and above on MacOS while using runas, |
| 2312 | to pass special characters to the command you need to escape |
| 2313 | the characters on the shell. |
| 2314 | |
| 2315 | Example: |
| 2316 | |
| 2317 | .. code-block:: bash |
| 2318 | |
| 2319 | cmd.run_all 'echo '\\''h=\\"baz\\"'\\''' runas=macuser |
no test coverage detected