From 2c741cd444a60fefbdb14e0a22763ad5820b97c1 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 4 Dec 2017 14:01:29 -0600 Subject: [PATCH] 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 --- suricata/update/commands/enablesource.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) -- 2.47.3