mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 23:11:33 +00:00
Simplify predicate finding logic YamlFSM
This commit is contained in:
parent
1beb419b09
commit
c7ee97f0c6
@ -42,9 +42,8 @@ class YamlFSM(FSMBase):
|
|||||||
json_obj[key] = partial(run_command_async, json_obj[key])
|
json_obj[key] = partial(run_command_async, json_obj[key])
|
||||||
|
|
||||||
def subscribe_and_remove_predicates(self, json_obj):
|
def subscribe_and_remove_predicates(self, json_obj):
|
||||||
for key in json_obj:
|
if 'predicates' in json_obj:
|
||||||
if key == 'predicates':
|
for predicate in json_obj['predicates']:
|
||||||
for predicate in json_obj[key]:
|
|
||||||
self.subscribe_predicate(
|
self.subscribe_predicate(
|
||||||
json_obj['trigger'],
|
json_obj['trigger'],
|
||||||
partial(
|
partial(
|
||||||
@ -52,6 +51,7 @@ class YamlFSM(FSMBase):
|
|||||||
predicate
|
predicate
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
with suppress(KeyError):
|
with suppress(KeyError):
|
||||||
json_obj.pop('predicates')
|
json_obj.pop('predicates')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user