From a8bf51020dfcc7c1d05f11c8ad21a0c124177edd Mon Sep 17 00:00:00 2001 From: Enno Tensing Date: Wed, 30 Jul 2025 11:07:21 +0200 Subject: [PATCH] generate: container: Implement timezone support Get timezone from the container config and fall back to local, which uses the hosts timezone, if the config entry is missing or not a string. Signed-off-by: Enno Tensing --- generate/container.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generate/container.py b/generate/container.py index e7970c5..c705166 100644 --- a/generate/container.py +++ b/generate/container.py @@ -535,6 +535,7 @@ class Container: replace: bool restart: str pull_policy: str + timezone: str network: Network dns: Dns ports: Ports @@ -561,6 +562,7 @@ class Container: replace = maybe(json, "replace") pull_policy = maybe_or(json, "pull_policy", "always") restart = maybe_or(json, "restart", "no") + timezone = maybe_or(json, "timezone", "local") network = maybe(json, "network") dns = maybe(json, "dns") ports = maybe(json, "ports") @@ -576,6 +578,7 @@ class Container: self.replace = replace is not None and bool(replace) self.pull_policy = str(pull_policy) self.restart = str(restart) + self.timezone = str(timezone) self.network = Network.from_json(network, logger) self.dns = Dns.from_json(dns, logger) self.ports = Ports.from_json(ports, logger) @@ -624,6 +627,7 @@ class Container: cmd += "\t--read-only \\\n" cmd += f"\t--restart={self.restart} \\\n" cmd += f"\t--pull={self.pull_policy} \\\n" + cmd += f"\t--tz={self.timezone} \\\n" cmd += f"\t{self.network.command()} \\\n" cmd += f"\t{self.dns.command()} \\\n" cmd += f"{self.ports.command()}"