Development

This commit is contained in:
Matthew Grotke 2026-06-11 01:31:57 -04:00
parent 4be98fd794
commit ef4bdef838
14 changed files with 780 additions and 1419 deletions

View file

@ -100,7 +100,6 @@ import health as health
import mod_avahi as avahi
import mod_captive as captive
import mod_dnsmasq as dnsmasq
import mod_metrics as metrics
import mod_networkd as networkd
import mod_nftables as nftables
import mod_radius as radius
@ -765,7 +764,7 @@ def cmd_apply(data, dry_run=False):
timer_files=[timers.HEALTH_TIMER_FILE],
svc_files=[timers.HEALTH_TIMER_SVC_FILE],
descriptions=["Router status health check"],
exec_starts=[f"/usr/bin/python3 {SCRIPT_DIR / 'health.py'}"],
exec_starts=[f"/usr/bin/python3 {SCRIPT_DIR / 'health.py'} --collect"],
interval_secs=[timers.HEALTH_TIMER_INTERVAL_SEC],
)
print()
@ -842,7 +841,6 @@ def main():
" sudo python3 core.py --view-leases Show active DHCP leases\n"
" sudo python3 core.py --view-rules Show active nftables ruleset\n"
" sudo python3 core.py --disable Stop instances, remove nftables, remove all config files\n"
" python3 core.py --view-metrics Show lifetime DNS metrics\n"
"\n"
" [--dry-run] may be combined with --apply or --disable\n"
" to preview all actions verbosely without making any changes:\n"
@ -861,13 +859,11 @@ def main():
"Optionally specify a VLAN name to reset only that VLAN.")
parser.add_argument("--view-rules", action="store_true", help="Show active nftables ruleset")
parser.add_argument("--disable", action="store_true", help="Stop instances, remove nftables, remove all config files")
parser.add_argument("--view-metrics", action="store_true", help="Show lifetime DNS metrics across all instances")
args = parser.parse_args()
if not any([args.apply, args.merge_blocklists,
args.dry_run, args.status, args.view_configs, args.view_leases,
args.view_rules, args.disable, args.view_metrics,
args.view_rules, args.disable,
args.reset_leases]):
parser.print_help()
sys.exit(0)
@ -908,12 +904,6 @@ def main():
nftables.show_rules()
return
if args.view_metrics:
if not shared.is_root():
die("This script must be run as root (sudo).")
metrics.show_metrics(data)
return
if args.disable:
if not args.dry_run:
if not shared.is_root():