Skip to content

Commit

Permalink
fix: if there is no cluster to create a default cluster (#1381)
Browse files Browse the repository at this point in the history
Co-authored-by: 曲源成 <[email protected]>
  • Loading branch information
quyuancheng and 曲源成 authored Aug 15, 2023
1 parent dc96b87 commit f672c2b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions console/views/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,17 @@ def get(self, request, *args, **kwargs):
except region_api.CallApiError as e:
logger.warning("数据中心{0}不可达,无法获取相关信息: {1}".format(self.response_region.region_name, e.message))
ent["is_enterprise"] = is_ent
regions = region_repo.get_regions_by_enterprise_id(self.enterprise.enterprise_id, 1)
default_region = {}
if os.getenv("ENABLE_CLUSTER") == "true" and not regions:
region = region_services.create_default_region(self.enterprise.enterprise_id, request.user)
if region:
ent["disable_install_cluster_log"] = True
_, total = team_services.get_enterprise_teams(self.enterprise.enterprise_id)
if total == 0:
region_services.create_sample_application(enter, region, request.user)
default_region = region.to_dict()
ent["default_region"] = default_region
result = general_message(200, "success", "查询成功", bean=ent)
return Response(result, status=result["code"])

Expand Down

0 comments on commit f672c2b

Please sign in to comment.