all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Mayr <stefan@mayr-stefan.de>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] use timedatectl to retrieve container host timezone
Date: Wed, 31 Dec 2025 11:27:42 +0100	[thread overview]
Message-ID: <20251231102741.6568-1-stefan@mayr-stefan.de> (raw)

In addition to fixing #7175 this also switches the /etc/timezone
dependency of the LXC integration to timedatectl.
One less dependency on that code in the INotify module.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Suggested-by: Maximiliano Sandroval <m.sandoval@proxmox.com>
Signed-off-by: Stefan Mayr <stefan@mayr-stefan.de>
---
 src/PVE/LXC/Setup.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index 87330c4..0d00376 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -127,7 +127,10 @@ sub new {
 
     # Cache some host files we need access to:
     $plugin->{host_resolv_conf} = PVE::INotify::read_file('resolvconf');
-    $plugin->{host_timezone} = PVE::INotify::read_file('timezone');
+    PVE::Tools::run_command(
+        ['timedatectl', 'show', '--property=Timezone', '--value'],
+        outfunc => sub { $plugin->{host_timezone} //= shift },
+    );
 
     abs_path('/etc/localtime') =~ m|^(/.+)| or die "invalid /etc/localtime\n"; # untaint
     $plugin->{host_localtime} = $1;
-- 
2.34.1


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

                 reply	other threads:[~2025-12-31 10:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251231102741.6568-1-stefan@mayr-stefan.de \
    --to=stefan@mayr-stefan.de \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal