def _update_component_record_status(self, record: ServiceUpgradeRecord, event_status): if event_status == "": return status_table = self.status_tables.get(record.status, {}) if not status_table: logger.warning("unexpected component upgrade record status: {}".format(record.status)) return status = status_table.get(event_status) if not status: logger.warning("unexpected event status: {}".format(event_status)) return record.status = status
def _create_component_record(self, events=list): event_ids = {event["service_id"]: event["event_id"] for event in events} records = [] for cpt in self.new_app.components(): event_id = event_ids.get(cpt.component.component_id) if not event_id: continue record = ServiceUpgradeRecord( create_time=datetime.now(), app_upgrade_record=self.rollback_record, service_id=cpt.component.component_id, service_cname=cpt.component.service_cname, upgrade_type=ServiceUpgradeRecord.UpgradeType.UPGRADE.value, event_id=event_id, status=UpgradeStatus.ROLLING.value, ) records.append(record) component_upgrade_record_repo.bulk_create(records)
def init(self): self.sources = [ Tenants(), TenantRegionInfo(), TenantRegionResource(), ServiceInfo(), TenantServiceInfo(), TenantServiceInfoDelete(), TenantServiceLog(), TenantServiceRelation(), TenantServiceEnv(), TenantServiceAuth(), TenantServiceExtendMethod(), ServiceDomain(), ServiceDomainCertificate(), PermRelService(), PermRelTenant(), PhoneCode(), TenantServiceL7Info(), TenantServiceEnvVar(), TenantServicesPort(), TenantServiceMountRelation(), TenantServiceVolume(), TenantServiceConfigurationFile(), ServiceGroup(), ServiceGroupRelation(), ImageServiceRelation(), ComposeServiceRelation(), ServiceRule(), ServiceRuleHistory(), ServiceCreateStep(), ServiceProbe(), ConsoleConfig(), TenantEnterprise(), TenantEnterpriseToken(), TenantServiceGroup(), ServiceTcpDomain(), ThirdPartyServiceEndpoints(), ServiceWebhooks(), GatewayCustomConfiguration(), ConsoleSysConfig(), RainbondCenterApp(), RainbondCenterAppInherit(), RainbondCenterPlugin(), ServiceShareRecord(), EnterpriseUserPerm(), TenantUserRole(), TenantUserPermission(), TenantUserRolePermission(), PermGroup(), ServiceRelPerms(), AppExportRecord(), UserMessage(), AppImportRecord(), GroupAppBackupRecord(), GroupAppMigrateRecord(), GroupAppBackupImportRecord(), Applicants(), DeployRelation(), ServiceBuildSource(), TenantServiceBackup(), AppUpgradeRecord(), ServiceUpgradeRecord(), RegionConfig(), CloundBangImages(), Announcement(), ]