Beispiel #1
0
    def send_upgrade_request(self, market_services, tenant, user, app_record, service_infos):
        """向数据中心发送更新请求"""
        from console.services.app_actions.app_deploy import AppDeployService

        for market_service in market_services:
            app_deploy_service = AppDeployService()
            app_deploy_service.set_impl(market_service)
            code, msg, event_id = app_deploy_service.execute(tenant, market_service.service, user, True, app_record.version)

            upgrade_repo.create_service_upgrade_record(app_record, market_service.service, event_id,
                                                       service_infos[market_service.service.service_id],
                                                       self._get_sync_upgrade_status(code, event_id))
    def send_rolling_request(self, market_services, tenant, user, app_record, service_records):
        """向数据中心发送回滚请求"""
        from console.services.app_actions.app_deploy import AppDeployService

        for market_service in market_services:
            app_deploy_service = AppDeployService()
            app_deploy_service.set_impl(market_service)
            code, msg, event_id = app_deploy_service.execute(tenant, market_service.service, user, True, app_record.version)
            service_record = service_records.get(service_id=market_service.service.service_id)
            upgrade_repo.change_service_record_status(service_record, self._get_sync_rolling_status(code, event_id))
            # 改变event id
            if code == 200:
                service_record.event_id = event_id
                service_record.save()
    def send_upgrade_request(self, market_services, tenant, user, app_record, service_infos, oauth_instance):
        """向数据中心发送更新请求"""
        from console.services.app_actions.app_deploy import AppDeployService

        for market_service in market_services:
            event_id = ""
            if market_service.changes:
                app_deploy_service = AppDeployService()
                app_deploy_service.set_impl(market_service)
                code, msg, event_id = app_deploy_service.execute(
                    tenant, market_service.service, user, True, app_record.version, oauth_instance=oauth_instance)
            else:
                # set record is UPGRADED
                code = 200
            upgrade_repo.create_service_upgrade_record(app_record, market_service.service, event_id,
                                                       service_infos[market_service.service.service_id],
                                                       self._get_sync_upgrade_status(code, event_id))
Beispiel #4
0
from console.services.app_config import deploy_type_service
from console.services.app_config import volume_service
from console.services.app_config.env_service import AppEnvVarService
from console.services.market_app_service import market_app_service
from console.services.team_services import team_services
from console.views.app_config.base import AppBaseView
from console.views.base import RegionTenantHeaderView
from www.apiclient.regionapi import RegionInvokeApi
from www.decorator import perm_required
from www.utils.return_message import error_message
from www.utils.return_message import general_message

logger = logging.getLogger("default")

env_var_service = AppEnvVarService()
app_deploy_service = AppDeployService()
region_api = RegionInvokeApi()


class StartAppView(AppBaseView):
    @never_cache
    @perm_required('start_service')
    def post(self, request, *args, **kwargs):
        """
        启动服务
        ---
        parameters:
            - name: tenantName
              description: 租户名
              required: true
              type: string