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 <[email protected]>
Suggested-by: Maximiliano Sandroval <[email protected]>
Signed-off-by: Stefan Mayr <[email protected]>
---
 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
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to