Skip to content

Commit 7f03dc0

Browse files
committed
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 <nicola.murino@gmail.com>
1 parent 52ae36f commit 7f03dc0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/dataprovider/dataprovider.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4797,8 +4797,20 @@ func updateEventActions() error {
47974797
if err != nil {
47984798
return err
47994799
}
4800+
enabledCommands := slices.Clone(EnabledActionCommands)
4801+
defer func() {
4802+
EnabledActionCommands = enabledCommands
4803+
}()
4804+
48004805
for _, action := range convertedActions {
48014806
providerLog(logger.LevelInfo, "updating placeholders for event action %q", action.Name)
4807+
if action.Options.CmdConfig.Cmd != "" {
4808+
// EnabledActionCommands are initialized after the data provider,
4809+
// so all commands should be allowed here temporarily.
4810+
if !slices.Contains(EnabledActionCommands, action.Options.CmdConfig.Cmd) {
4811+
EnabledActionCommands = append(EnabledActionCommands, action.Options.CmdConfig.Cmd)
4812+
}
4813+
}
48024814
if err := provider.updateEventAction(&action); err != nil {
48034815
return fmt.Errorf("unable to save updated event action %q: %w", action.Name, err)
48044816
}

0 commit comments

Comments
 (0)