From: Jason Ish Date: Wed, 9 Sep 2020 19:32:59 +0000 (-0600) Subject: Handle obsolete sources. X-Git-Tag: 1.2.0rc2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f82e2920300a749da101225b97ccce655cf42f58;p=thirdparty%2Fsuricata-update.git Handle obsolete sources. An obsolete source is a source that remains in the index but is otherwise non-functional. Much like deprecated sources it won't be displayed in list-sources without the --all flag. Obsolete sources will never be fetched. Instead a warning will be printed with the obsolete reason. --- diff --git a/suricata/update/commands/listsources.py b/suricata/update/commands/listsources.py index 2dc931f..103d77b 100644 --- a/suricata/update/commands/listsources.py +++ b/suricata/update/commands/listsources.py @@ -32,7 +32,7 @@ def register(parser): parser.add_argument("--enabled", action="store_true", help="List all enabled sources") parser.add_argument("--all", action="store_true", - help="List all sources (including deprecated)") + help="List all sources (including deprecated and obsolete)") parser.set_defaults(func=list_sources) def list_sources(): @@ -82,9 +82,10 @@ def list_sources(): is_not_free = source.get("subscribe-url") if free_only and is_not_free: continue - deprecated = source.get("deprecated") - if deprecated is not None and not config.args().all: - continue + if not config.args().all: + if source.get("deprecated") is not None or \ + source.get("obsolete") is not None: + continue print("%s: %s" % (util.bright_cyan("Name"), util.bright_magenta(name))) print(" %s: %s" % ( util.bright_cyan("Vendor"), util.bright_magenta(source["vendor"]))) @@ -112,3 +113,7 @@ def list_sources(): print(" %s: %s" % ( util.orange("Deprecated"), util.bright_magenta(source["deprecated"]))) + if "obsolete" in source: + print(" %s: %s" % ( + util.orange("Obsolete"), + util.bright_magenta(source["obsolete"]))) diff --git a/suricata/update/main.py b/suricata/update/main.py index 5c24aee..41cf0cb 100644 --- a/suricata/update/main.py +++ b/suricata/update/main.py @@ -894,6 +894,10 @@ def load_sources(suricata_version): if "deprecated" in source_config: logger.warn("Source has been deprecated: %s: %s" % ( name, source_config["deprecated"])) + if "obsolete" in source_config: + logger.warn("Source is obsolete and will not be fetched: %s: %s" % ( + name, source_config["obsolete"])) + continue logger.debug("Resolved source %s to URL %s.", name, url[0]) urls.append(url)