Skip to content

Commit

Permalink
Bug fix - merge global params before execution
Browse files Browse the repository at this point in the history
  • Loading branch information
arikalon1 committed Nov 1, 2021
1 parent 794566f commit 06355b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/robusta/core/playbooks/playbooks_event_handler_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any, Dict, Optional, List

from .base_trigger import TriggerEvent, BaseTrigger
from .playbook_utils import merge_global_params
from .playbooks_event_handler import PlaybooksEventHandler
from ..model.events import ExecutionBaseEvent
from ..reporting.base import Finding
Expand Down Expand Up @@ -106,12 +107,16 @@ def __run_playbook_actions(
if not action.action_params:
registered_action.func(execution_event)
else:
action_params = None
try:
params = registered_action.params_type(**action.action_params)
action_params = merge_global_params(
self.get_global_config(), action.action_params
)
params = registered_action.params_type(**action_params)
except Exception:
msg = (
f"Failed to create {registered_action.params_type} "
f"using {action.action_params} for running {action.action_name}"
f"using {action_params} for running {action.action_name}"
)
execution_event.response = self.__error_resp(msg)
continue
Expand Down

0 comments on commit 06355b2

Please sign in to comment.