From: Roland Häder Date: Wed, 23 Aug 2023 04:09:12 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0b577dc1e6d0eaf70d95c8f34b75732be7f62612;p=fba.git Continued: - added parameter --mode for updating node-info for detection mode - this mode does only check outdated instances --- diff --git a/fba/boot.py b/fba/boot.py index c25466f..d9fa4af 100644 --- a/fba/boot.py +++ b/fba/boot.py @@ -206,6 +206,7 @@ def init_parser(): parser.set_defaults(command=commands.update_nodeinfo) parser.add_argument("--domain", help="Instance name (aka. domain)") parser.add_argument("--software", help="Name of software, e.g. 'lemmy'") + parser.add_argument("--mode", help="Name of detection mode, e.g. 'auto_discovery'") parser.add_argument("--force", action="store_true", help="Forces update of data, no matter what.") parser.add_argument("--no-software", action="store_true", help="Checks only entries with no software type detected.") diff --git a/fba/commands.py b/fba/commands.py index eb3fe20..726233b 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1721,6 +1721,9 @@ def update_nodeinfo(args: argparse.Namespace) -> int: elif args.software is not None and args.software != "": logger.info("Fetching domains for args.software='%s'", args.software) database.cursor.execute("SELECT domain, software FROM instances WHERE software = ?", [args.software]) + elif args.mode is not None and args.mode != "": + logger.info("Fetching domains for args.mode='%s'", args.mode.upper()) + database.cursor.execute("SELECT domain, software FROM instances WHERE detection_mode = ? AND (last_nodeinfo < ? OR last_nodeinfo IS NULL)", [args.mode.upper(), time.time() - config.get("recheck_nodeinfo")]) elif args.no_software: logger.info("Fetching domains with no software type detected ...") database.cursor.execute("SELECT domain, software FROM instances WHERE software IS NULL AND (last_nodeinfo < ? OR last_nodeinfo IS NULL)", [time.time() - config.get("recheck_nodeinfo")])