st2api/st2api/controllers/v1/actionexecutions.py
def delete(self, id, requester_user, show_secrets=False):
        """
        Stops a single execution.

        Handles requests:
            DELETE /executions/<id>

        """
        if not requester_user:
            requester_user = UserDB(cfg.CONF.system_user.user)

        from_model_kwargs = {
            'mask_secrets': self._get_mask_secrets(requester_user, show_secrets=show_secrets)
        }
        execution_api = self._get_one_by_id(id=id, requester_user=requester_user,
                                            from_model_kwargs=from_model_kwargs,
                                            permission_type=PermissionType.EXECUTION_STOP)

        if not execution_api:
            abort(http_client.NOT_FOUND, 'Execution with id %s not found.' % id)

        liveaction_id = execution_api.liveaction['id']
        if not liveaction_id:
            abort(http_client.INTERNAL_SERVER_ERROR,
                  'Execution object missing link to liveaction %s.' % liveaction_id)

        try:
            liveaction_db = LiveAction.get_by_id(liveaction_id)
        except:
            abort(http_client.INTERNAL_SERVER_ERROR,
                  'Execution object missing link to liveaction %s.' % liveaction_id)

        if liveaction_db.status == LIVEACTION_STATUS_CANCELED:
            LOG.info(
                'Action %s already in "canceled" state; \
                returning execution object.' % liveaction_db.id
            )
            return execution_api

        if liveaction_db.status not in LIVEACTION_CANCELABLE_STATES:
            abort(http_client.OK, 'Action cannot be canceled. State = %s.' % liveaction_db.status)

        try:
            (liveaction_db, execution_db) = action_service.request_cancellation(
                liveaction_db, requester_user.name or cfg.CONF.system_user.user)
        except:
            LOG.exception('Failed requesting cancellation for liveaction %s.', liveaction_db.id)
            abort(http_client.INTERNAL_SERVER_ERROR, 'Failed canceling execution.')

        return ActionExecutionAPI.from_model(execution_db,
                                             mask_secrets=from_model_kwargs['mask_secrets'])

        Stops a single execution.

        Handles requests:
            DELETE /executions/<id>

        
Stops a single execution.
Handles requests:
DELETE /executions/
Stops a single execution . Handles requests : DELETE / executions /
def delete(self, id, requester_user, show_secrets=False):
        if not requester_user:
            requester_user = UserDB(cfg.CONF.system_user.user)
        from_model_kwargs = {
            'mask_secrets': self._get_mask_secrets(requester_user, show_secrets=show_secrets)
        }
        execution_api = self._get_one_by_id(id=id, requester_user=requester_user,
                                            from_model_kwargs=from_model_kwargs,
                                            permission_type=PermissionType.EXECUTION_STOP)
        if not execution_api:
            abort(http_client.NOT_FOUND, 'Execution with id %s not found.' % id)
        liveaction_id = execution_api.liveaction['id']
        if not liveaction_id:
            abort(http_client.INTERNAL_SERVER_ERROR,
                  'Execution object missing link to liveaction %s.' % liveaction_id)
        try:
            liveaction_db = LiveAction.get_by_id(liveaction_id)
        except:
            abort(http_client.INTERNAL_SERVER_ERROR,
                  'Execution object missing link to liveaction %s.' % liveaction_id)
        if liveaction_db.status == LIVEACTION_STATUS_CANCELED:
            LOG.info(
                'Action %s already in "canceled" state; \
                returning execution object.' % liveaction_db.id
            )
            return execution_api
        if liveaction_db.status not in LIVEACTION_CANCELABLE_STATES:
            abort(http_client.OK, 'Action cannot be canceled. State = %s.' % liveaction_db.status)
        try:
            (liveaction_db, execution_db) = action_service.request_cancellation(
                liveaction_db, requester_user.name or cfg.CONF.system_user.user)
        except:
            LOG.exception('Failed requesting cancellation for liveaction %s.', liveaction_db.id)
            abort(http_client.INTERNAL_SERVER_ERROR, 'Failed canceling execution.')
        return ActionExecutionAPI.from_model(execution_db,
                                             mask_secrets=from_model_kwargs['mask_secrets'])
def delete ( self , id , requester_user , show_secrets = False ) : if not requester_user : requester_user = UserDB ( cfg . CONF . system_user . user ) from_model_kwargs = { 'mask_secrets' : self . _get_mask_secrets ( requester_user , show_secrets = show_secrets ) } execution_api = self . _get_one_by_id ( id = id , requester_user = requester_user , from_model_kwargs = from_model_kwargs , permission_type = PermissionType . EXECUTION_STOP ) if not execution_api : abort ( http_client . NOT_FOUND , 'Execution with id %s not found.' % id ) liveaction_id = execution_api . liveaction [ 'id' ] if not liveaction_id : abort ( http_client . INTERNAL_SERVER_ERROR , 'Execution object missing link to liveaction %s.' % liveaction_id ) try : liveaction_db = LiveAction . get_by_id ( liveaction_id ) except : abort ( http_client . INTERNAL_SERVER_ERROR , 'Execution object missing link to liveaction %s.' % liveaction_id ) if liveaction_db . status == LIVEACTION_STATUS_CANCELED : LOG . info ( 'Action %s already in "canceled" state; \
                returning execution object.' % liveaction_db . id ) return execution_api if liveaction_db . status not in LIVEACTION_CANCELABLE_STATES : abort ( http_client . OK , 'Action cannot be canceled. State = %s.' % liveaction_db . status ) try : ( liveaction_db , execution_db ) = action_service . request_cancellation ( liveaction_db , requester_user . name or cfg . CONF . system_user . user ) except : LOG . exception ( 'Failed requesting cancellation for liveaction %s.' , liveaction_db . id ) abort ( http_client . INTERNAL_SERVER_ERROR , 'Failed canceling execution.' ) return ActionExecutionAPI . from_model ( execution_db , mask_secrets = from_model_kwargs [ 'mask_secrets' ] )
Stops a single execution.
Stops a single execution .
"""
        Stops a single execution.

        Handles requests:
            DELETE /executions/<id>

        """
self
id
requester_user
show_secrets