From 012f8569a139c8c7393ae519e11bc9a592e6b356 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 11 Dec 2023 00:54:01 +0100 Subject: [PATCH] Continued: - also check blacklist in instances.is_recent() function - first check against blacklist, then if it is recent (in commands.py) --- fba/commands.py | 8 ++++---- fba/models/instances.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 2e36ee4..8ae5722 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1502,12 +1502,12 @@ def update_nodeinfo(args: argparse.Namespace) -> int: cnt = 0 for row in domains: logger.debug("row[]='%s'", type(row)) - if not args.force and instances.is_recent(row["domain"], "last_nodeinfo"): - logger.debug("row[domain]='%s' has been recently checked - SKIPPED!", row["domain"]) - continue - elif blacklist.is_blacklisted(row["domain"]): + if blacklist.is_blacklisted(row["domain"]): logger.debug("row[domain]='%s' is blacklisted - SKIPPED!", row["domain"]) continue + elif not args.force and instances.is_recent(row["domain"], "last_nodeinfo"): + logger.debug("row[domain]='%s' has been recently checked - SKIPPED!", row["domain"]) + continue try: logger.info("Checking nodeinfo for row[domain]='%s',row[software]='%s' (%s%%) ...", row["domain"], row["software"], "{:5.1f}".format(cnt / len(domains) * 100)) diff --git a/fba/models/instances.py b/fba/models/instances.py index e861281..ab9995f 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -338,6 +338,8 @@ def is_recent(domain: str, column: str = "last_instance_fetch") -> bool: raise ValueError(f"Parameter column[]='{type(column)}' is not of type 'str'") elif not column.startswith("last_"): raise ValueError(f"Parameter column='{column}' is not expected") + elif blacklist.is_blacklisted(domain): + raise ValueError(f"domain='{domain}' is blacklisted but function was invoked") elif not is_registered(domain): logger.debug("domain='%s' is not registered, returning False - EXIT!", domain) return False -- 2.39.2