unintend some code
This commit is contained in:
@@ -125,9 +125,10 @@ class ConditionsConfig(BaseConfig):
|
|||||||
|
|
||||||
def __init__(self, config, rec=True):
|
def __init__(self, config, rec=True):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
if rec:
|
if not rec:
|
||||||
if "whitelist" in self:
|
return
|
||||||
self["whitelist"] = WhitelistConfig(self["whitelist"])
|
if "whitelist" in self:
|
||||||
|
self["whitelist"] = WhitelistConfig(self["whitelist"])
|
||||||
|
|
||||||
|
|
||||||
class AddHeaderConfig(BaseConfig):
|
class AddHeaderConfig(BaseConfig):
|
||||||
@@ -247,15 +248,16 @@ class QuarantineConfig(BaseConfig):
|
|||||||
|
|
||||||
def __init__(self, config, rec=True):
|
def __init__(self, config, rec=True):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
if rec:
|
if not rec:
|
||||||
if "metadata" not in self["store"]:
|
return
|
||||||
self["store"]["metadata"] = True
|
if "metadata" not in self["store"]:
|
||||||
self["store"] = StoreConfig(self["store"])
|
self["store"]["metadata"] = True
|
||||||
if "notify" in self:
|
self["store"] = StoreConfig(self["store"])
|
||||||
self["notify"] = NotifyConfig(self["notify"])
|
if "notify" in self:
|
||||||
if "whitelist" in self:
|
self["notify"] = NotifyConfig(self["notify"])
|
||||||
self["whitelist"] = ConditionsConfig(
|
if "whitelist" in self:
|
||||||
{"whitelist": self["whitelist"]}, rec)
|
self["whitelist"] = ConditionsConfig(
|
||||||
|
{"whitelist": self["whitelist"]}, rec)
|
||||||
|
|
||||||
|
|
||||||
class ActionConfig(BaseConfig):
|
class ActionConfig(BaseConfig):
|
||||||
@@ -283,10 +285,11 @@ class ActionConfig(BaseConfig):
|
|||||||
|
|
||||||
def __init__(self, config, rec=True):
|
def __init__(self, config, rec=True):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
if rec:
|
if not rec:
|
||||||
if "conditions" in self:
|
return
|
||||||
self["conditions"] = ConditionsConfig(self["conditions"])
|
if "conditions" in self:
|
||||||
self["action"] = self.ACTION_TYPES[self["type"]](self["options"])
|
self["conditions"] = ConditionsConfig(self["conditions"])
|
||||||
|
self["action"] = self.ACTION_TYPES[self["type"]](self["options"])
|
||||||
|
|
||||||
|
|
||||||
class RuleConfig(BaseConfig):
|
class RuleConfig(BaseConfig):
|
||||||
@@ -303,18 +306,19 @@ class RuleConfig(BaseConfig):
|
|||||||
|
|
||||||
def __init__(self, config, rec=True):
|
def __init__(self, config, rec=True):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
if rec:
|
if not rec:
|
||||||
if "conditions" in self:
|
return
|
||||||
self["conditions"] = ConditionsConfig(self["conditions"])
|
if "conditions" in self:
|
||||||
|
self["conditions"] = ConditionsConfig(self["conditions"])
|
||||||
|
|
||||||
actions = []
|
actions = []
|
||||||
for idx, action in enumerate(self["actions"]):
|
for idx, action in enumerate(self["actions"]):
|
||||||
if "loglevel" not in action:
|
if "loglevel" not in action:
|
||||||
action["loglevel"] = config["loglevel"]
|
action["loglevel"] = config["loglevel"]
|
||||||
if "pretend" not in action:
|
if "pretend" not in action:
|
||||||
action["pretend"] = config["pretend"]
|
action["pretend"] = config["pretend"]
|
||||||
actions.append(ActionConfig(action, rec))
|
actions.append(ActionConfig(action, rec))
|
||||||
self["actions"] = actions
|
self["actions"] = actions
|
||||||
|
|
||||||
|
|
||||||
class QuarantineMilterConfig(BaseConfig):
|
class QuarantineMilterConfig(BaseConfig):
|
||||||
@@ -339,15 +343,16 @@ class QuarantineMilterConfig(BaseConfig):
|
|||||||
|
|
||||||
def __init__(self, config, rec=True):
|
def __init__(self, config, rec=True):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
if rec:
|
if not rec:
|
||||||
rules = []
|
return
|
||||||
for idx, rule in enumerate(self["rules"]):
|
rules = []
|
||||||
if "loglevel" not in rule:
|
for idx, rule in enumerate(self["rules"]):
|
||||||
rule["loglevel"] = config["loglevel"]
|
if "loglevel" not in rule:
|
||||||
if "pretend" not in rule:
|
rule["loglevel"] = config["loglevel"]
|
||||||
rule["pretend"] = config["pretend"]
|
if "pretend" not in rule:
|
||||||
rules.append(RuleConfig(rule, rec))
|
rule["pretend"] = config["pretend"]
|
||||||
self["rules"] = rules
|
rules.append(RuleConfig(rule, rec))
|
||||||
|
self["rules"] = rules
|
||||||
|
|
||||||
|
|
||||||
def get_milter_config(cfgfile, raw=False):
|
def get_milter_config(cfgfile, raw=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user