From 63051b1e8fc4ff663ac66c01d7340dbabaea7bf3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 1 Mar 2024 07:36:44 +0100 Subject: [PATCH] Continued: - moved --same from nodeinfo.sh to command update_nodeinfo() --- fba/boot.py | 1 + fba/commands.py | 7 +++++-- nodeinfo.sh | 4 ---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fba/boot.py b/fba/boot.py index f0a109b..d87ef4d 100644 --- a/fba/boot.py +++ b/fba/boot.py @@ -230,6 +230,7 @@ def init_parser(): parser.add_argument("--no-auto", action="store_true", help="Checks only entries with other than AUTO_DISCOVERY as detection mode.") parser.add_argument("--no-detection", action="store_true", help="Checks only entries with no detection mode set.") parser.add_argument("--with-software", action="store_true", help="Checks only entries with any software type detected.") + parser.add_argument("--same", action="store_true", help="Checks only entries with domain and software being the same.") ### Fetch instances from instances.social ### parser = subparser_command.add_parser( diff --git a/fba/commands.py b/fba/commands.py index 66c36c6..91e998d 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -203,10 +203,10 @@ def fetch_bkali(args: argparse.Namespace) -> int: logger.debug("fetched[]='%s'", type(fetched)) if "error_message" in fetched: - logger.warning("post_json_api() for 'gql.sources.bka.li' returned error message='%s", fetched["error_message"]) + logger.warning("post_json_api() for 'gql.sources.bka.li' returned error message='%s' - EXIT!", fetched["error_message"]) return 100 elif isinstance(fetched["json"], dict) and "error" in fetched["json"] and "message" in fetched["json"]["error"]: - logger.warning("post_json_api() returned error: '%s", fetched["error"]["message"]) + logger.warning("post_json_api() returned error: '%s' - EXIT!", fetched["error"]["message"]) return 101 rows = fetched["json"] @@ -1532,6 +1532,9 @@ def update_nodeinfo(args: argparse.Namespace) -> int: elif args.no_detection: logger.info("Fetching domains with no detection mode being set ...") database.cursor.execute("SELECT domain, software FROM instances WHERE detection_mode IS NULL ORDER BY last_updated ASC") + elif args.same: + logger.info("Fetching domains with domain name and software being the same ...") + database.cursor.execute("SELECT domain, software FROM instances WHERE domain=software ORDER BY last_updated ASC") else: logger.info("Fetching domains for recently updated ...") database.cursor.execute("SELECT domain, software FROM instances ORDER BY last_updated ASC") diff --git a/nodeinfo.sh b/nodeinfo.sh index f286f05..2ba2944 100755 --- a/nodeinfo.sh +++ b/nodeinfo.sh @@ -28,10 +28,6 @@ elif [ "$1" = "--generator" ] then DOMAIN_LIST=$(sqlite3 blocks.db "SELECT domain FROM instances WHERE detection_mode='GENERATOR' ORDER BY last_updated ASC;") MODE="generator" -elif [ "$1" = "--same" ] -then - DOMAIN_LIST=$(sqlite3 blocks.db "SELECT domain FROM instances WHERE domain=software ORDER BY last_updated ASC;") - MODE="same" else DOMAIN_LIST=$(sqlite3 blocks.db "SELECT domain FROM instances WHERE software IS NULL AND nodeinfo_url IS NOT NULL ORDER BY last_updated ASC;") fi -- 2.39.5