[PR #20616] [MERGED] Fixes #20524: Enhance API script scheduling validation #15984

Closed
opened 2025-12-30 00:25:09 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20616
Author: @pheus
Created: 10/17/2025
Status: Merged
Merged: 10/19/2025
Merged by: @jnovinger

Base: mainHead: 20524-prevent-jobs-scheduled-in-the-past-via-api


📝 Commits (1)

  • f8b2efa feat(extras): Enhance API script scheduling validation

📊 Changes

2 files changed (+104 additions, -10 deletions)

View changed files

📝 netbox/extras/api/serializers_/scripts.py (+24 -3)
📝 netbox/extras/tests/test_api.py (+80 -7)

📄 Description

Fixes: #20524

Tightens script scheduling validation:

  • Rejects schedule_at values in the past.
  • When only interval is provided, starts now and repeats.
  • Uses local_now() for accurate, timezone‑aware comparisons.

Small, backward‑compatible fix to make scheduling behave as expected.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20616 **Author:** [@pheus](https://github.com/pheus) **Created:** 10/17/2025 **Status:** ✅ Merged **Merged:** 10/19/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `20524-prevent-jobs-scheduled-in-the-past-via-api` --- ### 📝 Commits (1) - [`f8b2efa`](https://github.com/netbox-community/netbox/commit/f8b2efacfd1a0e5e42970c5ea0871d4edd869a3f) feat(extras): Enhance API script scheduling validation ### 📊 Changes **2 files changed** (+104 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/api/serializers_/scripts.py` (+24 -3) 📝 `netbox/extras/tests/test_api.py` (+80 -7) </details> ### 📄 Description ### Fixes: #20524 Tightens script scheduling validation: - Rejects `schedule_at` values in the past. - When only `interval` is provided, starts now and repeats. - Uses `local_now()` for accurate, timezone‑aware comparisons. Small, backward‑compatible fix to make scheduling behave as expected. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:09 +01:00
adam closed this issue 2025-12-30 00:25:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15984