Repository: netbox-community/netbox
Pull request: 17444 fix event rules jobs enqueue
### Fixes: #17444 

Scripts pass in a name param in extras.events.process_event_rules to the enqueue function resulting in duplicate name params as there will be a name in kwargs.

Problem statement:
Event Rules not creating jobs
### Deployment Type

Self-hosted

### NetBox Version

v4.1.0

### Python Version

3.12

### Steps to Reproduce

1. Create an Event Rule to e.g. trigger a script when a device is created
2. Create a device

### Expected Behavior

Job should be created running the script

### Observed Behavior

No job is created. (Docker Container) console output:
`Cannot import events pipeline extras.events.process_event_queue error: core.models.jobs.Job.enqueue() got multiple values for keyword argument 'name'`

Hints from issue discussion:
I have the same problem with my post upgrade testing. I replicated this in both my dev and test environments.

Commit message: 17444 fix event rules jobs enqueue

Patch to review:
diff --git a/netbox/netbox/jobs.py b/netbox/netbox/jobs.py
index b0fcc3e9944..76bbd54475a 100644
--- a/netbox/netbox/jobs.py
+++ b/netbox/netbox/jobs.py
@@ -100,7 +100,11 @@ def enqueue(cls, *args, **kwargs):
         This method is a wrapper of `Job.enqueue()` using `handle()` as function callback. See its documentation for
         parameters.
         """
-        return Job.enqueue(cls.handle, name=cls.name, *args, **kwargs)
+        name = kwargs.pop('name', None)
+        if not name:
+            name = cls.name
+
+        return Job.enqueue(cls.handle, name=name, *args, **kwargs)
 
     @classmethod
     @advisory_lock(ADVISORY_LOCK_KEYS['job-schedules'])


Code review comments:
diff_hunk: @@ -100,7 +100,11 @@ def enqueue(cls, *args, **kwargs):
         This method is a wrapper of `Job.enqueue()` using `handle()` as function callback. See its documentation for
         parameters.
         """
-        return Job.enqueue(cls.handle, name=cls.name, *args, **kwargs)
+        name = kwargs.pop('name', None)
path: netbox/netbox/jobs.py
text: @user1:
Maybe just
`name = kwargs.pop('name', None) or cls.name`
?