Skip to content

Commit

Permalink
upsert trusted cluster cleanup (#48489)
Browse files Browse the repository at this point in the history
  • Loading branch information
fspmarshall authored Nov 6, 2024
1 parent a3a9a34 commit 9f0a114
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/auth/trustedcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,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
Expand Down

0 comments on commit 9f0a114

Please sign in to comment.