mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
fix: guard inotify sysctl limit updates against fact retrieval errors
This commit is contained in:
@@ -118,9 +118,15 @@ 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
|
||||||
|
try:
|
||||||
|
sysctls = host.get_fact(Sysctl)
|
||||||
|
except Exception:
|
||||||
|
sysctls = None
|
||||||
|
|
||||||
|
if sysctls:
|
||||||
for name in ("max_user_instances", "max_user_watches"):
|
for name in ("max_user_instances", "max_user_watches"):
|
||||||
key = f"fs.inotify.{name}"
|
key = f"fs.inotify.{name}"
|
||||||
if host.get_fact(Sysctl)[key] > 65535:
|
if sysctls.get(key, 0) > 65535:
|
||||||
# Skip updating limits if already sufficient
|
# Skip updating limits if already sufficient
|
||||||
# (enables running in incus containers where sysctl readonly)
|
# (enables running in incus containers where sysctl readonly)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user