mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-21 14:05:34 +08:00
upsert trusted cluster cleanup (#48176)
This commit is contained in:
@@ -54,13 +54,15 @@ func (a *Server) UpsertTrustedCluster(ctx context.Context, tc types.TrustedClust
|
||||
// It is recommended to omit trusted cluster name because the trusted cluster name
|
||||
// is updated to the roots cluster name during the handshake with the root cluster.
|
||||
var existingCluster types.TrustedCluster
|
||||
var cas []types.CertAuthority
|
||||
if tc.GetName() != "" {
|
||||
var err error
|
||||
existingCluster, err = a.GetTrustedCluster(ctx, tc.GetName())
|
||||
ec, err := a.GetTrustedCluster(ctx, tc.GetName())
|
||||
if err != nil && !trace.IsNotFound(err) {
|
||||
return nil, trace.Wrap(err)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
existingCluster = ec
|
||||
}
|
||||
}
|
||||
|
||||
// if there is no existing cluster, switch to the create case
|
||||
|
||||
Reference in New Issue
Block a user