Skip to content

Instantly share code, notes, and snippets.

@mirceaulinic
Last active August 2, 2023 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirceaulinic/99be5bf05abb3efcfbb202c0cc3bf2c2 to your computer and use it in GitHub Desktop.
Save mirceaulinic/99be5bf05abb3efcfbb202c0cc3bf2c2 to your computer and use it in GitHub Desktop.
salt-sproxy Python client
root@salt:/# isalt --master
__ _______. ___ __ .___________.
| | / | / \ | | | |
| | | (----` / ^ \ | | `---| |----`
| | \ \ / /_\ \ | | | |
| | .----) | / _____ \ | `----. | |
|__| |_______/ /__/ \__\ |_______| |__|
Role: Master
Salt version: 3006.1
IPython version: 8.12.0
In [1]: import salt.runner
In [2]: r = salt.runner.RunnerClient(__opts__)
In [3]: r.cmd("proxy.execute", arg=("tst1",), kwarg={"salt_function": "test.ping", "static": True})
tst1:
True
Out[3]: {'tst1': True}
In [4]: r.cmd("proxy.execute", arg=("tst1,), kwarg={"salt_function": "test.arg", "static": True, "args": ("a", "b"), "some_extr_arg": True})
tst1:
----------
args:
- a
- b
kwargs:
----------
some_extr_arg:
True
Out[4]: {'tst1': {'args': ['a', 'b'], 'kwargs': {'some_extr_arg': True}}}
In [5]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment