Closes 20817 fix datasource sync broken when cron is set #851

Closed
opened 2026-04-05 18:11:03 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @ifoughal on 11/19/2025

Fixes: #20817

Datasources sync was broken when the user sets a sync interval.

The fix introduces 2 new states:

  • Ready
  • Scheduled

Ready state is set when the data-source object is not new. ie: either updated or changed state recently.
Scheduled is set when the user sets a sync interval.

This PR includes the following logic enhancements:

  • by removing DataSourceStatusChoices.QUEUED from the ready_for_sync method, we let the user sync the data-source anytime even when a daily interval is set, as long as the data-source is enabled.

  • Include the 2 new states (Scheduled, Ready) in the clean & save properties of data-source form model, to set the status correctly depending on the user inputs/

    • If the user creates a new data-source object, then the state is new.
    • if the user update the object with a defined interval, then the states changes to scheduled
    • if the user removed the sync interval, then the state changes to Ready.
    • if a sync is completed either successfully or with a failure, then the status will get update with the job's status as before without impact.
*Originally created by @ifoughal on 11/19/2025* ### Fixes: #20817 Datasources sync was broken when the user sets a sync interval. The fix introduces 2 new states: - Ready - Scheduled Ready state is set when the data-source object is not new. ie: either updated or changed state recently. Scheduled is set when the user sets a sync interval. This PR includes the following logic enhancements: - by removing ```DataSourceStatusChoices.QUEUED``` from the ```ready_for_sync``` method, we let the user sync the data-source anytime even when a daily interval is set, as long as the data-source is enabled. - Include the 2 new states (Scheduled, Ready) in the clean & save properties of data-source form model, to set the status correctly depending on the user inputs/ - If the user creates a new data-source object, then the state is new. - if the user update the object with a defined interval, then the states changes to scheduled - if the user removed the sync interval, then the state changes to Ready. - if a sync is completed either successfully or with a failure, then the status will get update with the job's status as before without impact.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#851