Skip to content

Commit

Permalink
remove grant overlaps error in exp request aws workflow (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
shwethaumashanker committed Jun 14, 2023
1 parent ccfcd30 commit 6dd241b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/granted/exp/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"time"

"github.com/AlecAivazis/survey/v2"
Expand Down Expand Up @@ -102,6 +103,7 @@ func requestAccess(ctx context.Context, opts requestAccessOpts) error {
return errors.Wrap(err, "loading keyring")
}

// creates the Common Fate API client
cf, err := client.FromConfig(ctx, cfcfg, client.WithKeyring(k), client.WithLoginHint("granted login"))
if err != nil {
return err
Expand Down Expand Up @@ -365,8 +367,13 @@ func requestAccess(ctx context.Context, opts requestAccessOpts) error {
},
With: withPtr,
})

if err != nil {
return err
if strings.Contains(err.Error(), "this request overlaps an existing grant") {
clio.Warn("This request has already been approved, continuing anyway...")
} else {
return err
}
}

si.Stop()
Expand Down

0 comments on commit 6dd241b

Please sign in to comment.