Example #1
0
 def create_app_import_record_2_enterprise(self, eid, user_name):
     event_id = make_uuid()
     try:
         region = region_repo.get_region_by_enterprise_id(eid)
     except TenantRegionInfo.DoesNotExist:
         raise RegionNotFound("region not found")
     if not region:
         raise RegionNotFound("region not found")
     import_record_params = {
         "event_id": event_id,
         "status": "uploading",
         "enterprise_id": eid,
         "region": region.region_name,
         "user_name": user_name
     }
     return app_import_record_repo.create_app_import_record(**import_record_params)
Example #2
0
 def select_handle_region(self, eid):
     data = region_services.get_enterprise_regions(eid,
                                                   level="safe",
                                                   status=1,
                                                   check_status=True)
     if data:
         for region in data:
             if region["rbd_version"] != "":
                 return region_services.get_region_by_region_id(
                     data[0]["region_id"])
     raise RegionNotFound("暂无可用的集群,应用导出功能不可用")
 def update_enterprise_region(self, eid, region_id, data):
     region = self.get_region_by_id(eid, region_id)
     if not region:
         raise RegionNotFound("region no found")
     region.region_alias = data.get("region_alias")
     region.url = data.get("url")
     region.wsurl = data.get("wsurl")
     region.httpdomain = data.get("httpdomain")
     region.tcpdomain = data.get("tcpdomain")
     if data.get("scope"):
         region.scope = data.get("scope")
     region.ssl_ca_cert = data.get("ssl_ca_cert")
     region.cert_file = data.get("cert_file")
     region.desc = data.get("desc")
     region.key_file = data.get("key_file")
     region.save()
     return region