Skip to content

Commit

Permalink
Fix incorrect netbox/arp rule deletion
Browse files Browse the repository at this point in the history
43d5543 deleted the incorrect database
rule and made it into a release.  This reinstates the rule, ensures
data integrity and deletes the *correct* rule: `netbox_status_close_arp`
  • Loading branch information
lunkwill42 committed May 30, 2024
1 parent 4797ef5 commit 9d1eb2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/2910.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace incorrect fix for premature ARP record closure introduced in 5.10.1
12 changes: 12 additions & 0 deletions python/nav/models/sql/changes/sc.05.10.0002.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Reinstate rule that closes ARP records on netbox deletion, see #2910
CREATE OR REPLACE RULE netbox_close_arp AS ON DELETE TO netbox
DO UPDATE arp SET end_time=NOW()
WHERE netboxid=OLD.netboxid AND end_time='infinity';

-- Close all open ARP records that have no associated netbox (those that may have been kept open in error due to
-- deletions between 5.10.1 and 5.10.2)
UPDATE arp SET end_time=NOW()
WHERE end_time>='infinity' AND netboxid IS NULL;

-- Remove actually malfunctioning ARP record closing rule, see #2910
DROP RULE IF EXISTS netbox_status_close_arp ON netbox;

0 comments on commit 9d1eb2d

Please sign in to comment.