示例#1
0
    def _post_generic_trigger(self, liveaction=None, execution=None):
        if not ACTION_SENSOR_ENABLED:
            LOG.debug(
                'Action trigger is disabled, skipping trigger dispatch...')
            return

        execution_id = str(execution.id)
        payload = {
            'execution_id': execution_id,
            'status': liveaction.status,
            'start_timestamp': str(liveaction.start_timestamp),
            # deprecate 'action_name' at some point and switch to 'action_ref'
            'action_name': liveaction.action,
            'action_ref': liveaction.action,
            'runner_ref': self._get_runner_ref(liveaction.action),
            'parameters': liveaction.get_masked_parameters(),
            'result': liveaction.result
        }
        # Use execution_id to extract trace rather than liveaction. execution_id
        # will look-up an exact TraceDB while liveaction depending on context
        # may not end up going to the DB.
        trace_context = self._get_trace_context(execution_id=execution_id)
        LOG.debug('POSTing %s for %s. Payload - %s. TraceContext - %s',
                  ACTION_TRIGGER_TYPE['name'], liveaction.id, payload,
                  trace_context)
        self._trigger_dispatcher.dispatch(self._action_trigger,
                                          payload=payload,
                                          trace_context=trace_context)
示例#2
0
    def _post_generic_trigger(self, liveaction=None, execution_id=None):
        if not ACTION_SENSOR_ENABLED:
            LOG.debug("Action trigger is disabled, skipping trigger dispatch...")
            return

        payload = {
            "execution_id": execution_id,
            "status": liveaction.status,
            "start_timestamp": str(liveaction.start_timestamp),
            # deprecate 'action_name' at some point and switch to 'action_ref'
            "action_name": liveaction.action,
            "action_ref": liveaction.action,
            "runner_ref": self._get_runner_ref(liveaction.action),
            "parameters": liveaction.get_masked_parameters(),
            "result": liveaction.result,
        }
        # Use execution_id to extract trace rather than liveaction. execution_id
        # will look-up an exact TraceDB while liveaction depending on context
        # may not end up going to the DB.
        trace_context = self._get_trace_context(execution_id=execution_id)
        LOG.debug(
            "POSTing %s for %s. Payload - %s. TraceContext - %s",
            ACTION_TRIGGER_TYPE["name"],
            liveaction.id,
            payload,
            trace_context,
        )
        self._trigger_dispatcher.dispatch(self._action_trigger, payload=payload, trace_context=trace_context)
示例#3
0
文件: notifier.py 项目: ipv1337/st2
    def _post_generic_trigger(self, liveaction=None, execution_id=None):
        if not ACTION_SENSOR_ENABLED:
            LOG.debug('Action trigger is disabled, skipping trigger dispatch...')
            return

        payload = {'execution_id': execution_id,
                   'status': liveaction.status,
                   'start_timestamp': str(liveaction.start_timestamp),
                   # deprecate 'action_name' at some point and switch to 'action_ref'
                   'action_name': liveaction.action,
                   'action_ref': liveaction.action,
                   'runner_ref': self._get_runner_ref(liveaction.action),
                   'parameters': liveaction.get_masked_parameters(),
                   'result': liveaction.result}
        LOG.debug('POSTing %s for %s. Payload - %s.', ACTION_TRIGGER_TYPE['name'],
                  liveaction.id, payload)
        self._trigger_dispatcher.dispatch(self._action_trigger, payload=payload)
示例#4
0
    def _post_generic_trigger(self, liveaction=None, execution_id=None):
        if not ACTION_SENSOR_ENABLED:
            LOG.debug('Action trigger is disabled, skipping trigger dispatch...')
            return

        payload = {'execution_id': execution_id,
                   'status': liveaction.status,
                   'start_timestamp': str(liveaction.start_timestamp),
                   # deprecate 'action_name' at some point and switch to 'action_ref'
                   'action_name': liveaction.action,
                   'action_ref': liveaction.action,
                   'runner_ref': self._get_runner_ref(liveaction.action),
                   'parameters': liveaction.get_masked_parameters(),
                   'result': liveaction.result}
        LOG.debug('POSTing %s for %s. Payload - %s.', ACTION_TRIGGER_TYPE['name'],
                  liveaction.id, payload)
        self._trigger_dispatcher.dispatch(self._action_trigger, payload=payload)
示例#5
0
    def _post_generic_trigger(self, liveaction=None, execution=None):
        if not ACTION_SENSOR_ENABLED:
            LOG.debug('Action trigger is disabled, skipping trigger dispatch...')
            return

        execution_id = str(execution.id)
        payload = {'execution_id': execution_id,
                   'status': liveaction.status,
                   'start_timestamp': str(liveaction.start_timestamp),
                   # deprecate 'action_name' at some point and switch to 'action_ref'
                   'action_name': liveaction.action,
                   'action_ref': liveaction.action,
                   'runner_ref': self._get_runner_ref(liveaction.action),
                   'parameters': liveaction.get_masked_parameters(),
                   'result': liveaction.result}
        # Use execution_id to extract trace rather than liveaction. execution_id
        # will look-up an exact TraceDB while liveaction depending on context
        # may not end up going to the DB.
        trace_context = self._get_trace_context(execution_id=execution_id)
        LOG.debug('POSTing %s for %s. Payload - %s. TraceContext - %s',
                  ACTION_TRIGGER_TYPE['name'], liveaction.id, payload, trace_context)
        self._trigger_dispatcher.dispatch(self._action_trigger, payload=payload,
                                          trace_context=trace_context)