mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
parent
2073fa2700
commit
436012aeb8
@ -27,6 +27,19 @@ __outputter__ = {
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def __resolve_struct(value, kwval_as):
|
||||||
|
'''
|
||||||
|
Take a string representing a structure and safely serialize it with the
|
||||||
|
specified medium
|
||||||
|
'''
|
||||||
|
if kwval_as == 'yaml':
|
||||||
|
return = _yaml_load(value, _YamlCustomLoader)
|
||||||
|
elif kwval_as == 'json':
|
||||||
|
return = json.loads(value)
|
||||||
|
elif kwval_as is None or kwval_as == 'verbatim':
|
||||||
|
return = value
|
||||||
|
|
||||||
|
|
||||||
def running():
|
def running():
|
||||||
'''
|
'''
|
||||||
Return a dict of state return data if a state function is already running.
|
Return a dict of state return data if a state function is already running.
|
||||||
@ -132,7 +145,11 @@ def highstate(test=None, **kwargs):
|
|||||||
if not test is None:
|
if not test is None:
|
||||||
opts['test'] = test
|
opts['test'] = test
|
||||||
|
|
||||||
st_ = salt.state.HighState(opts)
|
pillar = __resolve_struct(
|
||||||
|
kwargs.get('pillar', ''),
|
||||||
|
kwargs.get('kwval_as', 'yaml'))
|
||||||
|
|
||||||
|
st_ = salt.state.HighState(opts, pillar)
|
||||||
salt.state.HighState.current = st_
|
salt.state.HighState.current = st_
|
||||||
ret = st_.call_highstate(exclude=kwargs.get('exclude', []))
|
ret = st_.call_highstate(exclude=kwargs.get('exclude', []))
|
||||||
serial = salt.payload.Serial(__opts__)
|
serial = salt.payload.Serial(__opts__)
|
||||||
@ -167,8 +184,12 @@ def sls(mods, env='base', test=None, exclude=None, **kwargs):
|
|||||||
if not test is None:
|
if not test is None:
|
||||||
opts['test'] = test
|
opts['test'] = test
|
||||||
|
|
||||||
|
pillar = __resolve_struct(
|
||||||
|
kwargs.get('pillar', ''),
|
||||||
|
kwargs.get('kwval_as', 'yaml'))
|
||||||
|
|
||||||
salt.utils.daemonize_if(opts, **kwargs)
|
salt.utils.daemonize_if(opts, **kwargs)
|
||||||
st_ = salt.state.HighState(opts)
|
st_ = salt.state.HighState(opts, pillar)
|
||||||
|
|
||||||
if isinstance(mods, string_types):
|
if isinstance(mods, string_types):
|
||||||
mods = mods.split(',')
|
mods = mods.split(',')
|
||||||
|
Loading…
Reference in New Issue
Block a user