From 7f03dc0fab53fc5d00309e9f4dc3435be651bc63 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 20 Sep 2025 17:59:15 +0200 Subject: [PATCH] convert action migration: allow to import any command action EnabledCommands are initialized after the migration so allow any command, they will be denied if not allowed and this is temporary. The migration will be removed in the future Signed-off-by: Nicola Murino --- internal/dataprovider/dataprovider.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/dataprovider/dataprovider.go b/internal/dataprovider/dataprovider.go index 8a9da290..f4bb7211 100644 --- a/internal/dataprovider/dataprovider.go +++ b/internal/dataprovider/dataprovider.go @@ -4797,8 +4797,20 @@ func updateEventActions() error { if err != nil { return err } + enabledCommands := slices.Clone(EnabledActionCommands) + defer func() { + EnabledActionCommands = enabledCommands + }() + for _, action := range convertedActions { providerLog(logger.LevelInfo, "updating placeholders for event action %q", action.Name) + if action.Options.CmdConfig.Cmd != "" { + // EnabledActionCommands are initialized after the data provider, + // so all commands should be allowed here temporarily. + if !slices.Contains(EnabledActionCommands, action.Options.CmdConfig.Cmd) { + EnabledActionCommands = append(EnabledActionCommands, action.Options.CmdConfig.Cmd) + } + } if err := provider.updateEventAction(&action); err != nil { return fmt.Errorf("unable to save updated event action %q: %w", action.Name, err) }