From 0ba94dc6138962b979a23a85a29e7f606b76b71d Mon Sep 17 00:00:00 2001 From: missytake Date: Wed, 11 Jun 2025 21:58:38 +0200 Subject: [PATCH] dovecot: set TZ=:/etc/localtime to improve performance --- cmdeploy/src/cmdeploy/__init__.py | 7 +++++++ cmdeploy/src/cmdeploy/tests/online/test_1_basic.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/cmdeploy/src/cmdeploy/__init__.py b/cmdeploy/src/cmdeploy/__init__.py index e35260ba..cd149a90 100644 --- a/cmdeploy/src/cmdeploy/__init__.py +++ b/cmdeploy/src/cmdeploy/__init__.py @@ -410,6 +410,13 @@ def _configure_dovecot(config: Config, debug: bool = False) -> bool: persist=True, ) + timezone_env = files.line( + name="Set TZ environment variable", + path="/etc/environment", + line="TZ=:/etc/localtime", + ) + need_restart |= timezone_env.changed + return need_restart diff --git a/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py b/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py index 80a28c91..d6962864 100644 --- a/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py +++ b/cmdeploy/src/cmdeploy/tests/online/test_1_basic.py @@ -65,6 +65,14 @@ class TestSSHExecutor: assert (now - since_date).total_seconds() < 60 * 60 * 51 +def test_timezone_env(remote): + for line in remote.iter_output("env"): + print(line) + if line == "tz=:/etc/localtime": + return True + pytest.fail("TZ is not set") + + def test_remote(remote, imap_or_smtp): lineproducer = remote.iter_output(imap_or_smtp.logcmd) imap_or_smtp.connect()