Skip to content

Commit

Permalink
Fix --confirm flag parsing (#693)
Browse files Browse the repository at this point in the history
* Fix `--confirm` flag parsing

The flag was set as a string, rather than a bool.

* use the correct '--confirm' flag
  • Loading branch information
chrnorm authored Jul 3, 2024
1 parent 7d4da7f commit 36b51d7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/assume/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func GlobalFlags() []cli.Flag {
&cli.StringFlag{Name: "aws-config-file"},
&cli.StringFlag{Name: "chain", Usage: "Assume a given role ARN using the profile selected"},
&cli.StringFlag{Name: "reason", Usage: "Provide a reason for requesting access to the role"},
&cli.StringFlag{Name: "confirm", Usage: "Use this to skip confirmation prompts for access requests"},
&cli.BoolFlag{Name: "confirm", Aliases: []string{"y"}, Usage: "Skip confirmation prompts for access requests"},
&cli.BoolFlag{Name: "wait", Usage: "When using Granted with Common Fate the assume will halt while waiting for the access request to be approved."},
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/granted/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var latestCommand = cli.Command{
Flags: []cli.Flag{
&cli.StringFlag{Name: "reason", Usage: "A reason for access"},
&cli.DurationFlag{Name: "duration", Usage: "Duration of request, defaults to max duration of the access rule."},
&cli.BoolFlag{Name: "confirm", Usage: "Confirm requesting access"},
&cli.BoolFlag{Name: "confirm", Aliases: []string{"y"}, Usage: "Skip confirmation prompts for access requests"},
},
Action: func(c *cli.Context) error {
latest, err := accessrequest.LatestProfile()
Expand Down
2 changes: 1 addition & 1 deletion pkg/hook/accessrequesthook/accessrequesthook.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func DryRun(ctx context.Context, apiURL *url.URL, client accessv1alpha1connect.A

if !confirm {
if !IsTerminal(os.Stdin.Fd()) {
return false, nil, errors.New("detected a noninteractive terminal: to apply the planned changes please re-run with the --confirm-access-request flag")
return false, nil, errors.New("detected a noninteractive terminal: to apply the planned changes please re-run with the --confirm flag")
}

withStdio := survey.WithStdio(os.Stdin, os.Stderr, os.Stderr)
Expand Down

0 comments on commit 36b51d7

Please sign in to comment.