mirror of
https://github.com/chatmail/relay.git
synced 2026-05-18 14:48:57 +00:00
fix: guard inotify sysctl limit updates against fact retrieval errors
This commit is contained in:
@@ -118,18 +118,24 @@ def _configure_dovecot(config: Config, debug: bool = False) -> (bool, bool):
|
|||||||
|
|
||||||
# as per https://doc.dovecot.org/configuration_manual/os/
|
# as per https://doc.dovecot.org/configuration_manual/os/
|
||||||
# it is recommended to set the following inotify limits
|
# it is recommended to set the following inotify limits
|
||||||
for name in ("max_user_instances", "max_user_watches"):
|
try:
|
||||||
key = f"fs.inotify.{name}"
|
sysctls = host.get_fact(Sysctl)
|
||||||
if host.get_fact(Sysctl)[key] > 65535:
|
except Exception:
|
||||||
# Skip updating limits if already sufficient
|
sysctls = None
|
||||||
# (enables running in incus containers where sysctl readonly)
|
|
||||||
continue
|
if sysctls:
|
||||||
server.sysctl(
|
for name in ("max_user_instances", "max_user_watches"):
|
||||||
name=f"Change {key}",
|
key = f"fs.inotify.{name}"
|
||||||
key=key,
|
if sysctls.get(key, 0) > 65535:
|
||||||
value=65535,
|
# Skip updating limits if already sufficient
|
||||||
persist=True,
|
# (enables running in incus containers where sysctl readonly)
|
||||||
)
|
continue
|
||||||
|
server.sysctl(
|
||||||
|
name=f"Change {key}",
|
||||||
|
key=key,
|
||||||
|
value=65535,
|
||||||
|
persist=True,
|
||||||
|
)
|
||||||
|
|
||||||
timezone_env = files.line(
|
timezone_env = files.line(
|
||||||
name="Set TZ environment variable",
|
name="Set TZ environment variable",
|
||||||
|
|||||||
Reference in New Issue
Block a user