trace: Add two validations for passed arguments (#4399)

This commit is contained in:
Anis Elleuch
2022-12-12 08:43:09 -08:00
committed by GitHub
parent 97beb1108d
commit c4c0547a57
+6
View File
@@ -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