From: Roland Häder Date: Thu, 30 Nov 2023 17:54:05 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6a4fb931e3edf34f4ce3afbe4cb572355ec9738e;p=fba.git Continued: - software.is_relay() doesn't allow None/empty strings, let's handle them, too --- diff --git a/fba/commands.py b/fba/commands.py index b5c1acf..a663873 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -957,9 +957,12 @@ def fetch_instances(args: argparse.Namespace) -> int: origin = row["origin"] software = row["software"] - if software_helper.is_relay(software): - logger.warning("args.domain='%s' is of software type '%s' which is not supported by this command. Please invoke fetch_relays instead.", args.domain, software) + if software is None: + logger.warning("args.domain='%s' has no software detected. You can try to run ./fba.py update_nodeinfo --domain=%s --force to get it updated.", args.domain, args.domain) return 102 + elif software_helper.is_relay(software): + logger.warning("args.domain='%s' is of software type '%s' which is not supported by this command. Please invoke fetch_relays instead.", args.domain, software) + return 103 # Initial fetch try: @@ -969,7 +972,7 @@ def fetch_instances(args: argparse.Namespace) -> int: logger.warning("Exception '%s' during fetching instances (fetch_instances) from args.domain='%s'", type(exception), args.domain) instances.set_last_error(args.domain, exception) instances.update(args.domain) - return 100 + return 104 if args.single: logger.debug("Not fetching more instances - EXIT!") diff --git a/fba/http/federation.py b/fba/http/federation.py index f04fd3f..eab7df3 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -96,7 +96,7 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: instances.add(domain, origin, command, path, software) logger.debug("software='%s'", software) - if software_helper.is_relay(software): + if software is not None and software_helper.is_relay(software): logger.debug("software='%s' is a relay software - EXIT!", software) _DEPTH = _DEPTH - 1 return @@ -201,7 +201,7 @@ def fetch_peers(domain: str, software: str, origin: str) -> list: raise ValueError(f"Parameter software[]='{type(software)}' is not of type 'str'") elif isinstance(software, str) and software == "": raise ValueError("Parameter 'software' is empty") - elif software_helper.is_relay(software): + elif software is not None and software_helper.is_relay(software): raise ValueError(f"domain='{domain}' is of software='{software}' and isn't supported here.") elif not isinstance(origin, str) and origin is not None: raise ValueError(f"Parameter origin[]='{type(origin)}' is not of type 'str'")