예제 #1
0
파일: api.py 프로젝트: icclab/watcher
 def get_action_by_uuid(self, context, action_uuid):
     query = model_query(models.Action)
     query = query.filter_by(uuid=action_uuid)
     try:
         action = query.one()
         if not context.show_deleted:
             if action.state == 'DELETED':
                 raise exception.ActionNotFound(action=action_uuid)
         return action
     except exc.NoResultFound:
         raise exception.ActionNotFound(action=action_uuid)
예제 #2
0
파일: api.py 프로젝트: icclab/watcher
 def destroy_action(self, action_id):
     session = get_session()
     with session.begin():
         query = model_query(models.Action, session=session)
         query = add_identity_filter(query, action_id)
         count = query.delete()
         if count != 1:
             raise exception.ActionNotFound(action_id)
예제 #3
0
파일: api.py 프로젝트: laashub-soa/watcher
 def _get_action(self, context, fieldname, value, eager):
     try:
         return self._get(context,
                          model=models.Action,
                          fieldname=fieldname,
                          value=value,
                          eager=eager)
     except exception.ResourceNotFound:
         raise exception.ActionNotFound(action=value)
예제 #4
0
파일: api.py 프로젝트: icclab/watcher
    def soft_delete_action(self, action_id):
        session = get_session()
        with session.begin():
            query = model_query(models.Action, session=session)
            query = add_identity_filter(query, action_id)

            try:
                query.one()
            except exc.NoResultFound:
                raise exception.ActionNotFound(node=action_id)

            query.soft_delete()
예제 #5
0
파일: api.py 프로젝트: icclab/watcher
    def _do_update_action(self, action_id, values):
        session = get_session()
        with session.begin():
            query = model_query(models.Action, session=session)
            query = add_identity_filter(query, action_id)
            try:
                ref = query.with_lockmode('update').one()
            except exc.NoResultFound:
                raise exception.ActionNotFound(action=action_id)

            ref.update(values)
        return ref
예제 #6
0
파일: api.py 프로젝트: crowdy/watcher
 def soft_delete_action(self, action_id):
     try:
         return self._soft_delete(models.Action, action_id)
     except exception.ResourceNotFound:
         raise exception.ActionNotFound(action=action_id)