This commit is contained in:
2024-01-12 17:51:20 +01:00
parent 276aa06fe2
commit ab5469db29
4 changed files with 11 additions and 13 deletions

View File

@@ -119,7 +119,8 @@ def show(cfg, args):
qcfg = q["options"] qcfg = q["options"]
if "notification" in qcfg: if "notification" in qcfg:
notify_type = cfg["notifications"][qcfg["notification"]]["type"] notification = cfg["notifications"][qcfg["notification"]]
notify_type = notification["type"]
else: else:
notify_type = "NONE" notify_type = "NONE"

View File

@@ -297,11 +297,11 @@ class QuarantineConfig(BaseConfig):
if "metadata" not in self["storage"]: if "metadata" not in self["storage"]:
self["storage"]["metadata"] = True self["storage"]["metadata"] = True
if "notification" in self: if "notification" in self:
notification = self["notification"] name = self["notification"]
try: try:
self["notification"] = milter_config["notifications"][notification] self["notification"] = milter_config["notifications"][name]
except KeyError: except KeyError:
raise RuntimeError(f"notification '{notification}' not found") raise RuntimeError(f"notification '{name}' not found")
if "allowlist" in self: if "allowlist" in self:
allowlist = self["allowlist"] allowlist = self["allowlist"]
try: try:
@@ -344,11 +344,6 @@ class ActionConfig(BaseConfig):
if "conditions" in self: if "conditions" in self:
self["conditions"] = ConditionsConfig(self["conditions"], lists) self["conditions"] = ConditionsConfig(self["conditions"], lists)
if self["type"] == "store":
storage = StoreConfig(self["options"], milter_config)["storage"]
elif self["type"] == "notify":
notify = NotifyConfig(self["options"], milter_config)["notification"]
else:
self["action"] = self.ACTION_TYPES[self["type"]]( self["action"] = self.ACTION_TYPES[self["type"]](
self["options"], milter_config) self["options"], milter_config)

View File

@@ -337,7 +337,8 @@ class Notify:
nodification_type = cfg["options"]["notification"]["type"] nodification_type = cfg["options"]["notification"]["type"]
del cfg["options"]["notification"]["type"] del cfg["options"]["notification"]["type"]
self._notification = self.NOTIFICATION_TYPES[nodification_type](**cfg["options"]["notification"]) ncfg = cfg["options"]["notification"]
self._notification = self.NOTIFICATION_TYPES[nodification_type](**ncfg)
self._headersonly = self._notification._headersonly self._headersonly = self._notification._headersonly
def __str__(self): def __str__(self):

View File

@@ -377,7 +377,8 @@ class Store:
storage_type = cfg["options"]["storage"]["type"] storage_type = cfg["options"]["storage"]["type"]
del cfg["options"]["storage"]["type"] del cfg["options"]["storage"]["type"]
self._storage = self.STORAGE_TYPES[storage_type](**cfg["options"]["storage"]) scfg = cfg["options"]["storage"]
self._storage = self.STORAGE_TYPES[storage_type](**scfg)
self._headersonly = self._storage._headersonly self._headersonly = self._storage._headersonly
def __str__(self): def __str__(self):