mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add listen/listen_in support to stateconf.py
Add `listen/listen_in` everywhere where `watch/watch_in` is used.
This commit is contained in:
parent
af83f59313
commit
cd63541325
1 changed files with 8 additions and 8 deletions
|
@ -363,7 +363,7 @@ def statelist(states_dict, sid_excludes=frozenset(['include', 'exclude'])):
|
|||
|
||||
|
||||
REQUISITES = set([
|
||||
'require', 'require_in', 'watch', 'watch_in', 'use', 'use_in'
|
||||
'require', 'require_in', 'watch', 'watch_in', 'use', 'use_in', 'listen', 'listen_in'
|
||||
])
|
||||
|
||||
|
||||
|
@ -405,8 +405,8 @@ def rename_state_ids(data, sls, is_extend=False):
|
|||
del data[sid]
|
||||
|
||||
|
||||
REQUIRE = set(['require', 'watch'])
|
||||
REQUIRE_IN = set(['require_in', 'watch_in'])
|
||||
REQUIRE = set(['require', 'watch', 'listen'])
|
||||
REQUIRE_IN = set(['require_in', 'watch_in', 'listen_in'])
|
||||
EXTENDED_REQUIRE = {}
|
||||
EXTENDED_REQUIRE_IN = {}
|
||||
|
||||
|
@ -414,8 +414,8 @@ from itertools import chain
|
|||
|
||||
|
||||
# To avoid cycles among states when each state requires the one before it:
|
||||
# explicit require/watch can only contain states before it
|
||||
# explicit require_in/watch_in can only contain states after it
|
||||
# explicit require/watch/listen can only contain states before it
|
||||
# explicit require_in/watch_in/listen_in can only contain states after it
|
||||
def add_implicit_requires(data):
|
||||
|
||||
def T(sid, state): # pylint: disable=C0103
|
||||
|
@ -449,7 +449,7 @@ def add_implicit_requires(data):
|
|||
for _, rstate, rsid in reqs:
|
||||
if T(rsid, rstate) in states_after:
|
||||
raise SaltRenderError(
|
||||
'State({0}) can\'t require/watch a state({1}) defined '
|
||||
'State({0}) can\'t require/watch/listen a state({1}) defined '
|
||||
'after it!'.format(tag, T(rsid, rstate))
|
||||
)
|
||||
|
||||
|
@ -459,7 +459,7 @@ def add_implicit_requires(data):
|
|||
for _, rstate, rsid in reqs:
|
||||
if T(rsid, rstate) in states_before:
|
||||
raise SaltRenderError(
|
||||
'State({0}) can\'t require_in/watch_in a state({1}) '
|
||||
'State({0}) can\'t require_in/watch_in/listen_in a state({1}) '
|
||||
'defined before it!'.format(tag, T(rsid, rstate))
|
||||
)
|
||||
|
||||
|
@ -571,7 +571,7 @@ def extract_state_confs(data, is_extend=False):
|
|||
|
||||
if not is_extend and state_id in STATE_CONF_EXT:
|
||||
extend = STATE_CONF_EXT[state_id]
|
||||
for requisite in 'require', 'watch':
|
||||
for requisite in 'require', 'watch', 'listen':
|
||||
if requisite in extend:
|
||||
extend[requisite] += to_dict[state_id].get(requisite, [])
|
||||
to_dict[state_id].update(STATE_CONF_EXT[state_id])
|
||||
|
|
Loading…
Add table
Reference in a new issue