From 2f5dda55e5f6c4f585d3f44dc72a99e7feb47e8d Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Wed, 31 Jan 2024 10:42:39 +0100 Subject: [PATCH] fix(cmd): properly inherit `--all` flag. Signed-off-by: Federico Di Pierro --- cmd/run.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/run.go b/cmd/run.go index 711b8b49..c98c2c72 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -15,6 +15,8 @@ limitations under the License. package cmd import ( + "fmt" + "strings" "time" "github.com/falcosecurity/event-generator/events" @@ -95,12 +97,18 @@ Without arguments it runs all actions, otherwise only those actions matching the l := logger.StandardLogger() + // Honor --all too! + exeArgs := fmt.Sprintf("--loglevel %s run", l.GetLevel().String()) + if all { + exeArgs += " --all" + } + runOpts := []runner.Option{ runner.WithLogger(l), runner.WithKubeNamespace(ns), runner.WithKubeFactory(cmdutil.NewFactory(matchVersionKubeConfigFlags)), // todo(leogr): inherit other flags - runner.WithExecutable("", "--loglevel", l.GetLevel().String(), "run"), + runner.WithExecutable("", strings.Split(exeArgs, " ")...), runner.WithSleep(sleep), runner.WithLoop(loop), runner.WithAllEnabled(all),