From: Jason Ish Date: Mon, 4 Dec 2017 20:01:29 +0000 (-0600) Subject: remove sources that an enabled one replaces X-Git-Tag: 1.0.0a1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c741cd444a60fefbdb14e0a22763ad5820b97c1;p=thirdparty%2Fsuricata-update.git remove sources that an enabled one replaces For example, when enabling et/pro, if et/open is enabled, remove it, as its replaced by et/pro --- diff --git a/suricata/update/commands/enablesource.py b/suricata/update/commands/enablesource.py index 3164944..aa1113c 100644 --- a/suricata/update/commands/enablesource.py +++ b/suricata/update/commands/enablesource.py @@ -119,6 +119,16 @@ def enable_source(config): write_source_config(new_source, True) logger.info("Source %s enabled", new_source.name) + if "replaces" in source: + for replaces in source["replaces"]: + filename = sources.get_enabled_source_filename(replaces) + if os.path.exists(filename): + logger.info( + "Removing source %s as its replaced by %s", replaces, + new_source.name) + logger.debug("Deleting %s", filename) + os.unlink(filename) + def write_source_config(config, enabled): if enabled: filename = sources.get_enabled_source_filename(config.name)