Development

This commit is contained in:
Matthew Grotke 2026-06-03 20:54:33 -04:00
parent 885e5ec3ca
commit 65c5b61ca7
2 changed files with 29 additions and 6 deletions

View file

@ -105,6 +105,7 @@ PRODUCT_NAME = "routlin"
SCRIPT_DIR = Path(__file__).parent
CONFIG_FILE = SCRIPT_DIR / "config.json"
DASHBOARD_PENDING = SCRIPT_DIR / ".dashboard-pending"
BLOCKLIST_DIR = SCRIPT_DIR / "blocklists"
METRICS_FILE = SCRIPT_DIR / ".dns-metrics"
DNSMASQ_CONF_DIR = Path(f"/etc/dnsmasq-{PRODUCT_NAME}")
@ -2133,9 +2134,21 @@ def disable_avahi():
print("avahi-daemon: not running, skipping.")
def _remove_pending_cmd(cmd):
try:
if not DASHBOARD_PENDING.exists():
return
lines = DASHBOARD_PENDING.read_text().splitlines()
kept = [l for l in lines if f'[{cmd}]' not in l]
DASHBOARD_PENDING.write_text('\n'.join(kept) + ('\n' if kept else ''))
except Exception:
pass
def show_status(data):
import health as _health
_health.print_table(_health.run_and_write(data))
_, _status = _health.run_and_write(data)
_health.print_table(_status)
def show_configs(data):
for vlan in data["vlans"]:
@ -3093,7 +3106,12 @@ def cmd_apply(data, dry_run=False):
print("Done.")
import health as _health
_health.print_table(_health.run_and_write(data))
_healthy, _status = _health.run_and_write(data)
_health.print_table(_status)
_remove_pending_cmd('core apply')
if _healthy:
_remove_pending_cmd('fix problems')
def main():