MCPcopy
hub / github.com/saltstack/salt / run_salt

Method run_salt

tests/support/case.py:54–88  ·  view source on GitHub ↗

r''' Run the ``salt`` CLI tool with the provided arguments .. code-block:: python class MatchTest(ShellCase): def test_list(self): """ test salt -L matcher """ data = self.ru

(
        self,
        arg_str,
        with_retcode=False,
        catch_stderr=False,
        timeout=None,
        popen_kwargs=None,
        config_dir=None,
    )

Source from the content-addressed store, hash-verified

52 RUN_TIMEOUT = 30
53
54 def run_salt(
55 self,
56 arg_str,
57 with_retcode=False,
58 catch_stderr=False,
59 timeout=None,
60 popen_kwargs=None,
61 config_dir=None,
62 ):
63 r'''
64 Run the ``salt`` CLI tool with the provided arguments
65
66 .. code-block:: python
67
68 class MatchTest(ShellCase):
69 def test_list(self):
70 """
71 test salt -L matcher
72 """
73 data = self.run_salt('-L minion test.ping')
74 data = '\n'.join(data)
75 self.assertIn('minion', data)
76 '''
77 if timeout is None:
78 timeout = self.RUN_TIMEOUT
79
80 arg_str = f"-t {timeout} {arg_str}"
81 return self.run_script(
82 "salt",
83 arg_str,
84 with_retcode=with_retcode,
85 catch_stderr=catch_stderr,
86 timeout=timeout,
87 config_dir=config_dir,
88 )
89
90 def run_ssh(
91 self,

Calls 1

run_scriptMethod · 0.95