]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
list-sources: update-sources if no index found
authorJason Ish <ish@unx.ca>
Thu, 7 Dec 2017 20:49:43 +0000 (14:49 -0600)
committerJason Ish <ish@unx.ca>
Thu, 7 Dec 2017 22:16:40 +0000 (16:16 -0600)
Issue:
https://redmine.openinfosecfoundation.org/issues/2336

suricata/update/commands/listsources.py

index 3a8e45a3395e710fbfe42c9af26969c1a679d57c..c6be30316d01153547a4bd6672de9c810f613ee0 100644 (file)
@@ -21,6 +21,7 @@ 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
 
 logger = logging.getLogger()
 
@@ -29,10 +30,8 @@ def register(parser):
 
 def list_sources():
     if not sources.source_index_exists(config):
-        logger.warning(
-            "Source index does not exist, please run: "
-            "suricata-update update-sources")
-        return 1
+        logger.info("No source index found, running update-sources")
+        update_sources()
     index = sources.load_source_index(config)
     for name, source in index.get_sources().items():
         print("%s: %s" % (util.bright_cyan("Name"), util.bright_magenta(name)))