]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
Add warning to update sources if no index found
authorTharushi Jayasekara <tharushi68@gmail.com>
Thu, 8 Oct 2020 16:46:21 +0000 (22:16 +0530)
committerJason Ish <jason.ish@oisf.net>
Fri, 7 Jan 2022 18:00:19 +0000 (12:00 -0600)
Don't automatically update the sources on list-sources
if it does not exist. Instead just use the bundled version.

Ticket #3249.

suricata/update/commands/listsources.py
tests/integration_tests.py

index 103d77bdba9b541b4cb581bc4d82ff00f8d4f131..d35c3cd2cab36754d2669a9c2b262e5a0838ed5e 100644 (file)
@@ -21,7 +21,6 @@ import logging
 from suricata.update import config
 from suricata.update import sources
 from suricata.update import util
-from suricata.update.commands.updatesources import update_sources
 from suricata.update import exceptions
 
 logger = logging.getLogger()
@@ -72,11 +71,9 @@ def list_sources():
 
     free_only = config.args().free
     if not sources.source_index_exists(config):
-        logger.info("No source index found, running update-sources")
-        try:
-            update_sources()
-        except exceptions.ApplicationError as err:
-            logger.warning("%s: will use bundled index.", err)
+        logger.warning("Source index does not exist, will use bundled one.")
+        logger.warning("Please run suricata-update update-sources.")
+        
     index = sources.load_source_index(config)
     for name, source in index.get_sources().items():
         is_not_free = source.get("subscribe-url")
index b32e71452d152abe3c3fb0a9ac24a7efd4a35383..89705853f6e585e5b9c5be53e69cf30a543fccf7 100755 (executable)
@@ -84,8 +84,7 @@ assert (os.path.exists(os.path.join(DATA_DIR, "update", "cache",
 # the index.
 delete(os.path.join(DATA_DIR, "update", "cache", "index.yaml"))
 run(common_args + ["list-sources"])
-assert (os.path.exists(os.path.join(DATA_DIR, "update", "cache",
-                                    "index.yaml")))
+assert(not os.path.exists(os.path.join(DATA_DIR, "update", "cache", "index.yaml")))
 
 # Enable a source.
 run(common_args + ["enable-source", "oisf/trafficid"])