fix(get_config): strip valid_lft/preferred_lft — volatile DHCP fields cause false-positive config changes every poll
This commit is contained in:
+10
-1
@@ -693,8 +693,17 @@ class LinuxDriver(OSDriver):
|
||||
def get_config(
|
||||
self, retrieve: str = "all", full: bool = False, sanitized: bool = False
|
||||
) -> dict[str, Any]:
|
||||
"""Return minimal config representation (network interfaces only)."""
|
||||
"""Return minimal config representation (network interfaces only).
|
||||
|
||||
``valid_lft`` / ``preferred_lft`` fields from DHCP leases are stripped
|
||||
so the output is stable across polls and does not produce false-positive
|
||||
config-change events in the config-backup feature.
|
||||
"""
|
||||
import re
|
||||
|
||||
running = self._send("ip addr show && ip route show")
|
||||
# Strip volatile DHCP lease timer fields — they decrement every poll
|
||||
running = re.sub(r"\s+valid_lft\s+\S+\s+preferred_lft\s+\S+", "", running)
|
||||
return {"running": running, "startup": "", "candidate": ""}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user