Skip to content

Commit

Permalink
update to use deduplication for invalid cluster names
Browse files Browse the repository at this point in the history
Co-authored-by: Zac Bergquist <[email protected]>
  • Loading branch information
stevenGravy and zmb3 authored Dec 2, 2024
1 parent f27eb3f commit 01cf6f1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/services/access_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,8 @@ func ValidateAccessRequestClusterNames(cg ClusterGetter, ar types.AccessRequest)
}
}
if len(invalidClusters) > 0 {
// Multiple resources are requestable with the same or different cluster names.
// Prior to showing the error message, sort the list and remove duplicates so
// the same cluster name isn't repeated.
slices.Sort(invalidClusters)
invalidClusters = slices.Compact(invalidClusters)
return trace.NotFound("access request contains invalid or unknown cluster names: %v",
strings.Join(invalidClusters, ", "))
strings.Join(utils.Deduplicate(invalidClusters), ", "))
}
return nil
}
Expand Down

0 comments on commit 01cf6f1

Please sign in to comment.