Move init action manager function to the top

This commit is contained in:
Marek Wolan
2023-08-29 14:33:28 +01:00
parent f0b82cbdfb
commit 40d3e04e64
6 changed files with 79 additions and 79 deletions

View File

@@ -33,6 +33,17 @@ class Service(IOSoftware):
operating_state: ServiceOperatingState
"The current operating state of the Service."
def _init_action_manager(self) -> ActionManager:
am = super()._init_action_manager()
am.add_action("stop", Action(func=lambda request, context: self.stop()))
am.add_action("start", Action(func=lambda request, context: self.start()))
am.add_action("pause", Action(func=lambda request, context: self.pause()))
am.add_action("resume", Action(func=lambda request, context: self.resume()))
am.add_action("restart", Action(func=lambda request, context: self.restart()))
am.add_action("disable", Action(func=lambda request, context: self.disable()))
am.add_action("enable", Action(func=lambda request, context: self.enable()))
return am
@abstractmethod
def describe_state(self) -> Dict:
"""
@@ -47,17 +58,6 @@ class Service(IOSoftware):
state.update({"operating_state": self.operating_state.name})
return state
def _init_action_manager(self) -> ActionManager:
am = super()._init_action_manager()
am.add_action("stop", Action(func=lambda request, context: self.stop()))
am.add_action("start", Action(func=lambda request, context: self.start()))
am.add_action("pause", Action(func=lambda request, context: self.pause()))
am.add_action("resume", Action(func=lambda request, context: self.resume()))
am.add_action("restart", Action(func=lambda request, context: self.restart()))
am.add_action("disable", Action(func=lambda request, context: self.disable()))
am.add_action("enable", Action(func=lambda request, context: self.enable()))
return am
def reset_component_for_episode(self, episode: int):
"""
Resets the Service component for a new episode.