Skip to content

Commit

Permalink
fix: add cdn cluster to scheduler cluster (#887)
Browse files Browse the repository at this point in the history
* feat: add cdn cluster to scheduler cluster

Signed-off-by: Gaius <[email protected]>

* feat: update console submodule

Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Dec 7, 2021
1 parent 8e6596d commit 547829f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manager/console
9 changes: 9 additions & 0 deletions manager/service/cdn_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ func (s *rest) AddSchedulerClusterToCDNCluster(ctx context.Context, id, schedule
return err
}

cdnClusters := []model.CDNCluster{}
if err := s.db.WithContext(ctx).Model(&schedulerCluster).Association("CDNClusters").Find(&cdnClusters); err != nil {
return err
}

if err := s.db.WithContext(ctx).Model(&schedulerCluster).Association("CDNClusters").Delete(cdnClusters); err != nil {
return err
}

if err := s.db.WithContext(ctx).Model(&cdnCluster).Association("SchedulerClusters").Append(&schedulerCluster); err != nil {
return err
}
Expand Down

0 comments on commit 547829f

Please sign in to comment.