Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tool/tsh/common/tsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3759,8 +3759,15 @@ func getAutoResourceRequest(ctx context.Context, tc *client.TeleportClient, requ
req.SetDryRun(true)
req.SetRequestReason("Dry run, this request will not be created. If you see this, there is a bug.")
if err := tc.WithRootClusterClient(ctx, func(clt authclient.ClientI) error {
req, err = clt.CreateAccessRequestV2(ctx, req)
return trace.Wrap(err)
dryRunReq, err := clt.CreateAccessRequestV2(ctx, req)
if err != nil {
return trace.Wrap(err)
}
// Copying the computed roles here is not strictly necessary but avoids requiring
// the server to recompute the roles when the real request is created, which can be
// an expensive operation.
req.SetRoles(dryRunReq.GetRoles())
return nil
}); err != nil {
return nil, trace.Wrap(err)
}
Expand Down
Loading