loader: purge legacy driver in overlay namespace on teardown (self-heal nw-uns-modbus placeholder)
This commit is contained in:
@@ -254,6 +254,9 @@ def cmd_populate_equipment(args):
|
||||
cur.execute("DELETE FROM dbo.Equipment WHERE UnsLineId LIKE 'nw-line-%'")
|
||||
cur.execute("DELETE FROM dbo.UnsLine WHERE UnsLineId LIKE 'nw-line-%'")
|
||||
cur.execute("DELETE FROM dbo.UnsArea WHERE UnsAreaId LIKE 'nw-area-%'")
|
||||
# Equipment is now driver-less, but purge any driver still bound to the overlay namespace —
|
||||
# self-heals environments that ran an older loader which created the 'nw-uns-modbus' placeholder.
|
||||
cur.execute("DELETE FROM dbo.DriverInstance WHERE NamespaceId=%s", (EQ_NS,))
|
||||
cur.execute("DELETE FROM dbo.Namespace WHERE NamespaceId=%s", (EQ_NS,))
|
||||
|
||||
cur.execute(
|
||||
@@ -328,6 +331,9 @@ def cmd_clean(args):
|
||||
cur.execute("DELETE FROM dbo.Equipment WHERE UnsLineId LIKE 'nw-line-%'")
|
||||
cur.execute("DELETE FROM dbo.UnsLine WHERE UnsLineId LIKE 'nw-line-%'")
|
||||
cur.execute("DELETE FROM dbo.UnsArea WHERE UnsAreaId LIKE 'nw-area-%'")
|
||||
# Purge any driver still bound to the overlay namespace (e.g. the legacy 'nw-uns-modbus'
|
||||
# placeholder created by an older loader) so 'clean' fully removes the overlay.
|
||||
cur.execute("DELETE FROM dbo.DriverInstance WHERE NamespaceId=%s", (EQ_NS,))
|
||||
cur.execute("DELETE FROM dbo.Namespace WHERE NamespaceId=%s", (EQ_NS,))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user