Skip to content

netbox: send no DELETE request while pruning is disabled - #613

Merged
semx merged 1 commit into
developmentfrom
fix/no-delete-without-prune
Oct 31, 2026
Merged

semx merged 1 commit into
developmentfrom
fix/no-delete-without-prune

Conversation

@semx

@semx semx commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

With prune_enabled = False netbox-sync still sent DELETE requests in two places: for a virtual disk which is gone from vCenter (update_object, last run) and for tags of this program which no object uses anymore (delete_unused_tags, end of every run). A token without the delete permission is the natural setup for a disabled pruning. NetBox answers each of these requests with a 403, and request() ends the run on a 403, in the disk case in the middle of the update.

Both are done only if pruning is enabled now. A disk which vanished from vCenter stays in NetBox otherwise, so with the default (prune_enabled = False) it is no longer deleted. The option description says that no DELETE is sent while pruning is disabled. --purge is not touched.

The tests count the DELETE requests of a handler with a stubbed request(). The two with pruning disabled fail on development (a DELETE for the disk and one for the tag) and pass with this change, the two controls with pruning enabled pass in both cases. The rest of the suite is unchanged (525 passed on a box without vcsim, the vcsim tests run in CI). The generated example config matches the new option text.

Item 1 of #537, reported by @jamespage001.

A virtual disk which is gone from vCenter and the tags of this program which
no object uses anymore were deleted on every run, whatever prune_enabled
said. A token which may not delete is the natural setup for a disabled
pruning, and NetBox answers each of those requests with a 403, which ends the
run, for a disk in the middle of the update. Delete both only if pruning is
enabled, a disk which vanished from vCenter stays in NetBox otherwise.

Part of #537.
@semx
semx requested a review from bb-Ricardo as a code owner October 31, 2026 18:14
@semx
semx merged commit 4fd55fd into development Oct 31, 2026
1 check passed
@semx
semx deleted the fix/no-delete-without-prune branch October 31, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant