Skip to content

Commit eb002e7

Browse files
authored
upsert trusted cluster cleanup (#48491)
1 parent 8d94f16 commit eb002e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/auth/trustedcluster.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ func (a *Server) UpsertTrustedCluster(ctx context.Context, tc types.TrustedClust
5454
// It is recommended to omit trusted cluster name because the trusted cluster name
5555
// is updated to the roots cluster name during the handshake with the root cluster.
5656
var existingCluster types.TrustedCluster
57-
var cas []types.CertAuthority
5857
if tc.GetName() != "" {
59-
var err error
60-
existingCluster, err = a.GetTrustedCluster(ctx, tc.GetName())
58+
ec, err := a.GetTrustedCluster(ctx, tc.GetName())
6159
if err != nil && !trace.IsNotFound(err) {
6260
return nil, trace.Wrap(err)
6361
}
62+
63+
if err == nil {
64+
existingCluster = ec
65+
}
6466
}
6567

6668
// if there is no existing cluster, switch to the create case

0 commit comments

Comments
 (0)