15855 fix adding script as event rule
This commit is contained in:
parent
b12bfaa597
commit
ebbb92a630
|
@ -47,6 +47,8 @@ class EventRuleSerializer(NetBoxModelSerializer):
|
|||
# We need to manually instantiate the serializer for scripts
|
||||
if instance.action_type == EventRuleActionChoices.SCRIPT:
|
||||
script = instance.action_object
|
||||
instance = script.python_class() if script.python_class else None
|
||||
breakpoint()
|
||||
return ScriptSerializer(script, nested=True, context=context).data
|
||||
else:
|
||||
serializer = get_serializer_for_model(instance.action_object_type.model_class())
|
||||
|
|
|
@ -118,7 +118,7 @@ def process_event_rules(event_rules, model_name, event, data, username=None, sna
|
|||
# Enqueue a Job to record the script's execution
|
||||
Job.enqueue(
|
||||
"extras.scripts.run_script",
|
||||
instance=script.module,
|
||||
instance=event_rule.action_object,
|
||||
name=script.name,
|
||||
user=user,
|
||||
data=data
|
||||
|
|
Loading…
Reference in New Issue