mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add state.sls_exists to ssh client
fixes: #66893 Signed-off-by: Olivier Mehani <shtrom@ssji.net> Fix typo in sate.sls_exists doctstrings (module & ssh wrapper) Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
parent
40f871c2b1
commit
15573a8f20
4 changed files with 34 additions and 1 deletions
1
changelog/66894.added.md
Normal file
1
changelog/66894.added.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add support for state.sls_exists when using salt-ssh
|
|
@ -1113,6 +1113,28 @@ def show_low_sls(mods, saltenv="base", test=None, **kwargs):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def sls_exists(mods, test=None, queue=None, **kwargs):
|
||||||
|
"""
|
||||||
|
Tests for the existence of a specific SLS or list of SLS files on the
|
||||||
|
master. Similar to :py:func:`state.show_sls <salt.modules.state.show_sls>`,
|
||||||
|
rather than returning state details, returns True or False. The default
|
||||||
|
environment is ``base``, use ``saltenv`` to specify a different environment.
|
||||||
|
|
||||||
|
.. versionadded:: 3008.0
|
||||||
|
|
||||||
|
saltenv
|
||||||
|
Specify a salt fileserver environment from which to look for the SLS files
|
||||||
|
specified in the ``mods`` argument
|
||||||
|
|
||||||
|
CLI Example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
salt '*' state.sls_exists core,edit.vim saltenv=dev
|
||||||
|
"""
|
||||||
|
return isinstance(show_sls(mods, test=test, queue=queue, **kwargs), dict)
|
||||||
|
|
||||||
|
|
||||||
def show_top(**kwargs):
|
def show_top(**kwargs):
|
||||||
"""
|
"""
|
||||||
Return the top data that the minion will use for a highstate
|
Return the top data that the minion will use for a highstate
|
||||||
|
|
|
@ -2126,7 +2126,7 @@ def show_sls(mods, test=None, queue=None, **kwargs):
|
||||||
|
|
||||||
def sls_exists(mods, test=None, queue=None, **kwargs):
|
def sls_exists(mods, test=None, queue=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Tests for the existence the of a specific SLS or list of SLS files on the
|
Tests for the existence of a specific SLS or list of SLS files on the
|
||||||
master. Similar to :py:func:`state.show_sls <salt.modules.state.show_sls>`,
|
master. Similar to :py:func:`state.show_sls <salt.modules.state.show_sls>`,
|
||||||
rather than returning state details, returns True or False. The default
|
rather than returning state details, returns True or False. The default
|
||||||
environment is ``base``, use ``saltenv`` to specify a different environment.
|
environment is ``base``, use ``saltenv`` to specify a different environment.
|
||||||
|
|
|
@ -122,6 +122,16 @@ class SSHStateTest(SSHCase):
|
||||||
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE], wipe=False)
|
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE], wipe=False)
|
||||||
self.assertFalse(check_file)
|
self.assertFalse(check_file)
|
||||||
|
|
||||||
|
def test_state_sls_exists(self):
|
||||||
|
"""
|
||||||
|
test state.sls_exists with salt-ssh
|
||||||
|
"""
|
||||||
|
ret = self.run_function("state.sls_exists", [SSH_SLS])
|
||||||
|
self.assertTrue(ret)
|
||||||
|
|
||||||
|
check_file = self.run_function("file.file_exists", [SSH_SLS_FILE], wipe=False)
|
||||||
|
self.assertFalse(check_file)
|
||||||
|
|
||||||
def test_state_show_top(self):
|
def test_state_show_top(self):
|
||||||
"""
|
"""
|
||||||
test state.show_top with salt-ssh
|
test state.show_top with salt-ssh
|
||||||
|
|
Loading…
Add table
Reference in a new issue