From 39a5fb90275d0b2dc77743f34c171a3d7e2e0b61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 2 Jul 2023 20:29:28 +0200 Subject: [PATCH] Continued: - issue a warning when determined software type has changed --- fba/commands.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 5a59379..e8d0f72 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1376,13 +1376,13 @@ def update_nodeinfo(args: argparse.Namespace) -> int: if args.domain is not None and args.domain != "": logger.debug("Fetching args.domain='%s'", args.domain) - database.cursor.execute("SELECT domain FROM instances WHERE domain = ?", [args.domain]) + database.cursor.execute("SELECT domain, software FROM instances WHERE domain = ?", [args.domain]) elif args.software is not None and args.software != "": logger.info("Fetching domains for args.software='%s'", args.software) - database.cursor.execute("SELECT domain FROM instances WHERE software = ?", [args.software]) + database.cursor.execute("SELECT domain, software FROM instances WHERE software = ?", [args.software]) else: logger.info("Fetching domains for recently updated ...") - database.cursor.execute("SELECT domain FROM instances WHERE last_nodeinfo < ? OR last_nodeinfo IS NULL", [time.time() - config.get("recheck_block")]) + database.cursor.execute("SELECT domain, software FROM instances WHERE last_nodeinfo < ? OR last_nodeinfo IS NULL", [time.time() - config.get("recheck_block")]) domains = database.cursor.fetchall() @@ -1390,11 +1390,14 @@ def update_nodeinfo(args: argparse.Namespace) -> int: for row in domains: logger.debug("row[]='%s'", type(row)) try: - logger.info("Updating nodeinfo for row[domain]='%s' ...", row["domain"]) + logger.info("Updating nodeinfo for row[domain]='%s',row[software]='%s' ...", row["domain"], row["software"]) software = federation.determine_software(row["domain"]) - logger.info("Determined software='%s'", software) - instances.set_software(row["domain"], software) + logger.debug("Determined software='%s'", software) + if software != row["software"]: + logger.warning("Software type has changed from '%s' to '%s'!", row["software"], software) + instances.set_software(row["domain"], software) + instances.set_success(row["domain"]) except network.exceptions as exception: logger.warning("Exception '%s' during updating nodeinfo for row[domain]='%s'", type(exception), row["domain"]) -- 2.39.5