示例#1
0
 def attribute_delete(self, context, uuid):
     with _session_for_write():
         query = model_query(context, models.Attribute)
         query = add_identity_filter(query, uuid)
         count = query.delete()
         if count != 1:
             raise exception.AttributeNotFound(uuid=uuid)
示例#2
0
 def attribute_get_by_deployable_id(self, context, deployable_id):
     query = model_query(
         context, models.Attribute).filter_by(deployable_id=deployable_id)
     try:
         return query.all()
     except NoResultFound:
         raise exception.AttributeNotFound(uuid=uuid)
示例#3
0
 def attribute_get(self, context, uuid):
     query = model_query(
         context,
         models.Attribute).filter_by(uuid=uuid)
     try:
         return query.one()
     except NoResultFound:
         raise exception.AttributeNotFound(uuid=uuid)
示例#4
0
    def _do_update_attribute(self, context, uuid, key, value):
        update_fields = {'key': key, 'value': value}
        with _session_for_write():
            query = model_query(context, models.Attribute)
            query = add_identity_filter(query, uuid)
            try:
                ref = query.with_lockmode('update').one()
            except NoResultFound:
                raise exception.AttributeNotFound(uuid=uuid)

            ref.update(update_fields)
        return ref