]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
Handle obsolete sources. 253/head
authorJason Ish <jason.ish@oisf.net>
Wed, 9 Sep 2020 19:32:59 +0000 (13:32 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 9 Sep 2020 19:36:56 +0000 (13:36 -0600)
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.

suricata/update/commands/listsources.py
suricata/update/main.py

index 2dc931ff84a3663564acf873f79c115f7f3b6c7d..103d77bdba9b541b4cb581bc4d82ff00f8d4f131 100644 (file)
@@ -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"])))
index 5c24aeea9de3a011b59c23a730a24d45843a418f..41cf0cb699ea51060b355e1f4125075f2a67d691 100644 (file)
@@ -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)