contrib/clboss-forwarding-stats: validate --days and --db CLI inputs
Some checks failed
Code Base Sanity Check / tests (push) Has been cancelled
Code Base Sanity Check / coverage (push) Has been cancelled
Code Base Sanity Check / build-clang (push) Has been cancelled

- --days must be a strictly positive integer. Reject 0 and negative
    values which would push window_start_ts into the future or get
    silently treated as unset.

  - --db, when provided, must reference an existing file. Raise a
    clear argparse error at startup instead of bubbling up as a
    sqlite OperationalError later from inside the feemon loader.
This commit is contained in:
Ken Sedgwick 2026-03-05 09:36:23 -08:00
parent 18273b933c
commit 1a6d0f1974
No known key found for this signature in database
GPG key ID: DBD2AF0849D711A9

View file

@ -225,6 +225,12 @@ def main():
args = parser.parse_args()
if args.days is not None and args.days <= 0:
parser.error("--days must be a positive integer")
if args.db is not None and not os.path.isfile(args.db):
parser.error(f"--db file not found: {args.db}")
# Reconcile network option
if args.network:
network_option = f"--network={args.network}"