update the state wrapper to include show_low_sls

This commit is contained in:
Thomas S Hatch 2016-07-20 16:40:13 -06:00
parent 7bda166e9d
commit 77dce3920c

View file

@ -528,6 +528,56 @@ def show_sls(mods, saltenv='base', test=None, env=None, **kwargs):
return high_data
def show_low_sls(mods, saltenv='base', test=None, env=None, **kwargs):
'''
Display the low state data from a specific sls or list of sls files on the
master
CLI Example:
.. code-block:: bash
salt '*' state.show_sls core,edit.vim dev
'''
__pillar__.update(kwargs.get('pillar', {}))
__opts__['grains'] = __grains__
if env is not None:
salt.utils.warn_until(
'Carbon',
'Passing a salt environment should be done using \'saltenv\' '
'not \'env\'. This functionality will be removed in Salt Carbon.'
)
# Backwards compatibility
saltenv = env
opts = copy.copy(__opts__)
if salt.utils.test_mode(test=test, **kwargs):
opts['test'] = True
else:
opts['test'] = __opts__.get('test', None)
st_ = salt.client.ssh.state.SSHHighState(
__opts__,
__pillar__,
__salt__,
__context__['fileclient'])
if isinstance(mods, string_types):
mods = mods.split(',')
high_data, errors = st_.render_highstate({saltenv: mods})
high_data, ext_errors = st_.state.reconcile_extend(high_data)
errors += ext_errors
errors += st_.state.verify_high(high_data)
if errors:
return errors
high_data, req_in_errors = st_.state.requisite_in(high_data)
errors += req_in_errors
high_data = st_.state.apply_exclude(high_data)
# Verify that the high data is structurally sound
if errors:
return errors
ret = st_.state.compile_high_data(high_data)
return ret
def show_top():
'''
Return the top data that the minion will use for a highstate