From f232e7de5739d89f9a977beb1ef7b3e13e013ee9 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Tue, 8 Oct 2024 13:37:47 +0530 Subject: [PATCH] Address review comment --- cmd/admin-policy-attach.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/cmd/admin-policy-attach.go b/cmd/admin-policy-attach.go index 6faf28c7a0..78de2694b4 100644 --- a/cmd/admin-policy-attach.go +++ b/cmd/admin-policy-attach.go @@ -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 @@ -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") }