Renaming Agent classes to decorators to comply with the design pattern

This commit is contained in:
Mitsuo Takaki
2017-02-11 01:09:12 -08:00
parent e4bd02c44f
commit 3830063ba4

View File

@@ -37,12 +37,12 @@ class Decorator(object):
pass pass
class UpdateStatusAgent(Decorator): class UpdateStatusDecorator(Decorator):
def execute(self, configuration): def execute(self, configuration):
configuration.push_status() configuration.push_status()
class CreateIncidentAgent(Decorator): class CreateIncidentDecorator(Decorator):
def execute(self, configuration): def execute(self, configuration):
configuration.push_incident() configuration.push_incident()
@@ -57,9 +57,8 @@ class Scheduler(object):
def get_agent(self): def get_agent(self):
action_names = { action_names = {
'CREATE_INCIDENT': CreateIncidentAgent, 'CREATE_INCIDENT': CreateIncidentDecorator,
'UPDATE_STATUS': UpdateStatusAgent, 'UPDATE_STATUS': UpdateStatusDecorator,
None: Agent
} }
actions = [] actions = []
for action in self.configuration.get_action(): for action in self.configuration.get_action():