コード例 #1
0
 def get_all_by_lp(cls, context, lp):
     session = sql.SolumBase.get_session()
     apps = []
     with session.begin():
         query = session.query(cls).filter_by(languagepack=lp)
         apps = sql.filter_by_project(context, query).all()
         return apps
コード例 #2
0
ファイル: app.py プロジェクト: aneeshep/solum
 def get_all_by_lp(cls, context, lp):
     session = sql.SolumBase.get_session()
     apps = []
     with session.begin():
         query = session.query(cls).filter_by(languagepack=lp)
         apps = sql.filter_by_project(context, query).all()
         return apps
コード例 #3
0
 def update_and_save(cls, context, id_or_uuid, data):
     try:
         session = sql.SolumBase.get_session()
         with session.begin():
             query = session.query(cls).filter_by(id=id_or_uuid)
             obj = sql.filter_by_project(context, query).one()
             if obj._is_updatable():
                 obj.update(data)
                 session.merge(obj)
         return obj
     except orm_exc.NoResultFound:
         cls._raise_not_found(id_or_uuid)
コード例 #4
0
ファイル: workflow.py プロジェクト: aneeshep/solum
 def update_and_save(cls, context, id_or_uuid, data):
     try:
         session = sql.SolumBase.get_session()
         with session.begin():
             query = session.query(cls).filter_by(id=id_or_uuid)
             obj = sql.filter_by_project(context, query).one()
             if obj._is_updatable():
                 obj.update(data)
                 session.merge(obj)
         return obj
     except orm_exc.NoResultFound:
         cls._raise_not_found(id_or_uuid)
コード例 #5
0
ファイル: image.py プロジェクト: maniacs-ops/solum
 def get_by_name(cls, context, name, include_operators_lp=False):
     try:
         session = Image.get_session()
         result = session.query(cls).filter_by(
             artifact_type='language_pack', name=name)
         if include_operators_lp is True:
             result = result.filter(
                 Image.project_id.in_([operator_id, context.tenant]))
             return result.one()
         else:
             return sql.filter_by_project(context, result).one()
     except exc.NoResultFound:
         cls._raise_not_found(name)
コード例 #6
0
ファイル: image.py プロジェクト: dp1310/solum
 def get_by_name(cls, context, name, include_operators_lp=False):
     try:
         session = Image.get_session()
         result = session.query(cls).filter_by(
             artifact_type='language_pack', name=name)
         if include_operators_lp is True:
             result = result.filter(
                 Image.project_id.in_([operator_id, context.tenant]))
             return result.one()
         else:
             return sql.filter_by_project(context, result).one()
     except exc.NoResultFound:
         cls._raise_not_found(name)
コード例 #7
0
ファイル: image.py プロジェクト: maniacs-ops/solum
    def get_all_languagepacks(cls, context):
        """Return all images that are languagepacks."""
        session = Image.get_session()
        result = session.query(cls)
        result = result.filter_by(artifact_type='language_pack')
        result = sql.filter_by_project(context, result)

        # Include Languagepacks that have been created by the operator, and
        # are in the 'READY' state.
        # The operator LP is identified based on the operator_project_id
        # config setting in solum.conf
        oper_result = session.query(cls)
        oper_result = oper_result.filter_by(artifact_type='language_pack')
        oper_result = oper_result.filter_by(status='READY')
        oper_result = oper_result.filter_by(project_id=operator_id)

        return result.union(oper_result).all()
コード例 #8
0
ファイル: image.py プロジェクト: dp1310/solum
    def get_all_languagepacks(cls, context):
        """Return all images that are languagepacks."""
        session = Image.get_session()
        result = session.query(cls)
        result = result.filter_by(artifact_type='language_pack')
        result = sql.filter_by_project(context, result)

        # Include Languagepacks that have been created by the operator, and
        # are in the 'READY' state.
        # The operator LP is identified based on the operator_project_id
        # config setting in solum.conf
        oper_result = session.query(cls)
        oper_result = oper_result.filter_by(artifact_type='language_pack')
        oper_result = oper_result.filter_by(status='READY')
        oper_result = oper_result.filter_by(project_id=operator_id)

        return result.union(oper_result).all()
コード例 #9
0
 def get_lp_by_name_or_uuid(cls, context, name_or_uuid,
                            include_operators_lp=False):
     if uuidutils.is_uuid_like(name_or_uuid):
         try:
             session = Image.get_session()
             result = session.query(cls).filter_by(
                 artifact_type='language_pack', uuid=name_or_uuid)
             if include_operators_lp is True:
                 result = result.filter(
                     Image.project_id.in_([operator_id, context.tenant]))
                 return result.one()
             else:
                 return sql.filter_by_project(context, result).one()
         except exc.NoResultFound:
             return cls.get_by_name(context, name_or_uuid,
                                    include_operators_lp)
     else:
         return cls.get_by_name(context, name_or_uuid, include_operators_lp)