Skip to content

Commit 52e338a

Browse files
committed
Fix "Create" changelogs not being created when a scheduled script is re-enqueued.
1 parent 34c6df4 commit 52e338a

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@
3333

3434
# 0.3.4
3535

36-
* Added git sync action to API
36+
* Added git sync action to API.
3737

3838
# 0.3.5
3939

40-
* Fix API schema generation by adding docstring to rq-status endpoint
40+
* Fix API schema generation by adding docstring to rq-status endpoint.
4141

4242
# 0.3.6
4343

4444
* Cast log messages to string to prevent loggin None from throwing an error.
45-
* Fix schema for ScriptInstance actions
45+
* Fix schema for ScriptInstance actions.
46+
47+
# 0.3.7
48+
49+
* Fix "Create" changelogs not being created when a scheduled script is re-enqueued.

netbox_script_manager/scripts.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,19 +304,20 @@ def _run_script():
304304
"output": None,
305305
}
306306

307-
next_execution = ScriptExecution(
308-
script_instance=script_execution.script_instance,
309-
task_id=uuid.uuid4(),
310-
request_id=new_request_id,
311-
user=request.user,
312-
status=ScriptExecutionStatusChoices.STATUS_SCHEDULED,
313-
scheduled=new_scheduled_time,
314-
interval=script_execution.interval,
315-
task_queue=script_execution.task_queue,
316-
data=new_data,
317-
)
318-
next_execution.full_clean()
319-
next_execution.save()
307+
with change_logging(request):
308+
next_execution = ScriptExecution(
309+
script_instance=script_execution.script_instance,
310+
task_id=uuid.uuid4(),
311+
request_id=new_request_id,
312+
user=request.user,
313+
status=ScriptExecutionStatusChoices.STATUS_SCHEDULED,
314+
scheduled=new_scheduled_time,
315+
interval=script_execution.interval,
316+
task_queue=script_execution.task_queue,
317+
data=new_data,
318+
)
319+
next_execution.full_clean()
320+
next_execution.save()
320321

321322
queue = django_rq.get_queue(next_execution.task_queue)
322323

0 commit comments

Comments
 (0)