Cleanup completes migration while a retained module still has an unfinished built-in run

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
66/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start with _refusal_for() in netbox_scripts/migration/cleanup.py and trace how permanent history refusals are ordered relative to live_script_jobs. Reproduce the cleanup flow with a retained module that has a waiting or running built-in Job, including Jobs attached directly to the module. Done means cleanup reports the module as blocked and leaves the migration open in both cases.

Written by the indexing model from the issue text.

Description

app: scripts severity: low status: backlog type: bug
Plugin Version

v0.0.1

NetBox Version

v4.7.3

Python Version

3.12

Steps to Reproduce
  1. Create a built-in module containing two Custom Scripts, synchronized from a Data Source.
  2. Run one Script to completion. Remove its class from the source and synchronize the same module, keeping its Job history and the other Script.
  3. Under Scripts > Migration, complete the passes through Repoint references.
  4. As a superuser, schedule the remaining built-in Script for the following day.
  5. Select Clean up.
Expected Behavior

Cleanup counts the module as blocked and leaves migration open while it has a waiting or running built-in Job, even when its historical Jobs require the module to be retained.

Observed Behavior

Cleanup counts the module as retained, reports no blocked modules, and marks the migration migrated. Its warning mentions only the removed class's Job history. The scheduled Job still refers to the remaining built-in Script and can execute it later.

The same problem occurs when Job history belongs directly to the module. On main (7b7cdf1), _refusal_for() in netbox_scripts/migration/cleanup.py returns these permanent history refusals before checking live_script_jobs. A retained module does not keep the migration open.

Related: #4 covers Verify reporting, and #14 covers cleanup recovery advice.

Dominant language
Python
Stars
8
Forks
0
Avg merge
11h 23m
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netbox-community/netbox-scripts

All issues in netbox-community/netbox-scripts

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.