mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 18:51:31 +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])
|
||||
|
||||
def subscribe_and_remove_predicates(self, json_obj):
|
||||
for key in json_obj:
|
||||
if key == 'predicates':
|
||||
for predicate in json_obj[key]:
|
||||
if 'predicates' in json_obj:
|
||||
for predicate in json_obj['predicates']:
|
||||
self.subscribe_predicate(
|
||||
json_obj['trigger'],
|
||||
partial(
|
||||
@ -52,6 +51,7 @@ class YamlFSM(FSMBase):
|
||||
predicate
|
||||
)
|
||||
)
|
||||
|
||||
with suppress(KeyError):
|
||||
json_obj.pop('predicates')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user