Exemple #1
0
    def get(self, request, group_id, *args, **kwargs):
        """获取某云市应用的可升级版本"""
        group_key = parse_argument(
            request, 'group_key', value_type=str, required=True, error='group_key is a required parameter')

        # 获取云市应用可升级版本列表
        versions = upgrade_service.get_app_upgrade_versions(self.tenant, int(group_id), group_key)
        return MessageResponse(msg="success", list=list(versions))
 def yield_app_info():
     for group_key in set(service_group_keys):
         app_qs = rainbond_app_repo.get_rainbond_app_qs_by_key(
             group_key=group_key)
         app = app_qs.first()
         if not app:
             continue
         upgrade_versions = upgrade_service.get_app_upgrade_versions(
             self.tenant, group_id, group_key)
         not_upgrade_record = upgrade_service.get_app_not_upgrade_record(
             self.tenant.tenant_id, group_id, group_key)
         services = group_service.get_rainbond_services(
             int(group_id), group_key)
         yield {
             'current_version':
             upgrade_service.get_old_version(
                 group_key, services.values_list('service_id',
                                                 flat=True)),
             'can_upgrade':
             bool(upgrade_versions),
             'upgrade_versions':
             list(upgrade_versions),
             'not_upgrade_record_id':
             not_upgrade_record.ID,
             'not_upgrade_record_status':
             not_upgrade_record.status,
             'group_key':
             app.group_key,
             'group_name':
             app.group_name,
             'share_user':
             app.share_user,
             'share_team':
             app.share_team,
             'tenant_service_group_id':
             app.tenant_service_group_id,
             'pic':
             app.pic,
             'source':
             app.source,
             'describe':
             app.describe,
             'enterprise_id':
             app.enterprise_id,
             'is_official':
             app.is_official,
             'details':
             app.details,
             'min_memory':
             group_service.get_service_group_memory(app.app_template),
         }