Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dhananjaykrutika committed Oct 8, 2024
1 parent a475287 commit f232e7d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions cmd/admin-policy-attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ func mainAdminPolicyAttach(ctx *cli.Context) error {
return userAttachOrDetachPolicy(ctx, true)
}

func isCodeChangeAlreadyAppliedError(e error) bool {
switch v := e.(type) {
case madmin.ErrorResponse:
if v.Code == errCodeChangeAlreadyApplied {
return true
}
}
return false
}

func userAttachOrDetachPolicy(ctx *cli.Context, attach bool) error {
if len(ctx.Args()) < 2 {
showCommandHelpAndExit(ctx, 1) // last argument is exit code
Expand Down Expand Up @@ -112,7 +102,7 @@ func userAttachOrDetachPolicy(ctx *cli.Context, attach bool) error {
res, e = client.DetachPolicy(globalContext, req)
}

if e != nil && !isCodeChangeAlreadyAppliedError(e) {
if e != nil && madmin.ToErrorResponse(e).Code != errCodeChangeAlreadyApplied {
fatalIf(probe.NewError(e), "Unable to make user/group policy association")
}

Expand Down

0 comments on commit f232e7d

Please sign in to comment.