Пример #1
0
class AnnouncementRunner(ActionRunner):
    def __init__(self, runner_id):
        super(AnnouncementRunner, self).__init__(runner_id=runner_id)
        self._dispatcher = AnnouncementDispatcher(LOG)

    def pre_run(self):
        super(AnnouncementRunner, self).pre_run()

        LOG.debug('Entering AnnouncementRunner.pre_run() for liveaction_id="%s"',
                  self.liveaction_id)

        if not self.runner_parameters.get('experimental'):
            message = ('Experimental flag is missing for action %s' % self.action.ref)
            LOG.exception('Experimental runner is called without experimental flag.')
            raise runnerexceptions.ActionRunnerPreRunError(message)

        self._route = self.runner_parameters.get('route')

    def run(self, action_parameters):
        trace_context = self.liveaction.context.get('trace_context', None)
        if trace_context:
            trace_context = TraceContext(**trace_context)

        self._dispatcher.dispatch(self._route,
                                  payload=action_parameters,
                                  trace_context=trace_context)
        return (LIVEACTION_STATUS_SUCCEEDED, action_parameters, None)
Пример #2
0
 def __init__(self, runner_id):
     super(AnnouncementRunner, self).__init__(runner_id=runner_id)
     self._dispatcher = AnnouncementDispatcher(LOG)
Пример #3
0
 def __init__(self, runner_id):
     super(AnnouncementRunner, self).__init__(runner_id=runner_id)
     self._dispatcher = AnnouncementDispatcher(LOG)