From c4c0547a57f252e1e23f602c896b457d31bfe471 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 12 Dec 2022 17:43:09 +0100 Subject: [PATCH] trace: Add two validations for passed arguments (#4399) --- cmd/admin-trace.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/admin-trace.go b/cmd/admin-trace.go index 0ff1c44b..84a3c6f4 100644 --- a/cmd/admin-trace.go +++ b/cmd/admin-trace.go @@ -126,6 +126,10 @@ func checkAdminTraceSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { showCommandHelpAndExit(ctx, 1) // last argument is exit code } + + if ctx.Bool("all") && len(ctx.StringSlice("call")) > 0 { + fatalIf(errDummy().Trace(), "You cannot specify both --all and --call flags at the same time.") + } } func printTrace(verbose bool, traceInfo madmin.ServiceTraceInfo) { @@ -312,6 +316,8 @@ func tracingOpts(ctx *cli.Context, apis []string) (opts madmin.ServiceTraceOpts, opts.Rebalance = true case "replication-resync": opts.ReplicationResync = true + default: + return madmin.ServiceTraceOpts{}, fmt.Errorf("unknown call name: `%s`", api) } } return