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

Function exec_code

salt/modules/cmdmod.py:3476–3491  ·  view source on GitHub ↗

Pass in two strings, the first naming the executable language, aka - python2, python3, ruby, perl, lua, etc. the second string containing the code you wish to execute. The stdout will be returned. All parameters from :mod:`cmd.run_all ` except python_sh

(lang, code, cwd=None, args=None, **kwargs)

Source from the content-addressed store, hash-verified

3474
3475
3476def exec_code(lang, code, cwd=None, args=None, **kwargs):
3477 """
3478 Pass in two strings, the first naming the executable language, aka -
3479 python2, python3, ruby, perl, lua, etc. the second string containing
3480 the code you wish to execute. The stdout will be returned.
3481
3482 All parameters from :mod:`cmd.run_all <salt.modules.cmdmod.run_all>` except python_shell can be used.
3483
3484 CLI Example:
3485
3486 .. code-block:: bash
3487
3488 salt '*' cmd.exec_code ruby 'puts "cheese"'
3489 salt '*' cmd.exec_code ruby 'puts "cheese"' args='["arg1", "arg2"]' env='{"FOO": "bar"}'
3490 """
3491 return exec_code_all(lang, code, cwd, args, **kwargs)["stdout"]
3492
3493
3494def exec_code_all(lang, code, cwd=None, args=None, **kwargs):

Callers

nothing calls this directly

Calls 1

exec_code_allFunction · 0.85

Tested by

no test coverage detected