mirror of
https://github.com/ZmnSCPxj/clboss.git
synced 2026-08-13 12:33:20 +02:00
contrib/clboss-forwarding-stats: validate --days and --db CLI inputs
- --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:
parent
18273b933c
commit
1a6d0f1974
1 changed files with 6 additions and 0 deletions
|
|
@ -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}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue