public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Mayr <stefan@mayr-stefan.de>
To: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH manager 1/1] Fix #7175: use timedatectl for timezone handling
Date: Fri, 16 Jan 2026 22:55:04 +0100	[thread overview]
Message-ID: <8cfd59fe-ac2e-4d81-8fe5-c962b099f83c@mayr-stefan.de> (raw)
In-Reply-To: <f5721994-5e13-430b-a5cf-a2c3a71fedd2@mayr-stefan.de>

Am 16.01.2026 um 22:30 schrieb Stefan Mayr:
> Am 15.01.2026 um 11:25 schrieb Fabian Grünbichler:
>> On December 25, 2025 9:05 am, Stefan Mayr wrote:
>>> Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>>> Signed-off-by: Stefan Mayr <stefan@mayr-stefan.de>
>>> ---
>>>   PVE/API2/Nodes.pm | 9 +++++++--
>>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
>>> index 6a6465b6..54ed712e 100644
>>> --- a/PVE/API2/Nodes.pm
>>> +++ b/PVE/API2/Nodes.pm
>>> @@ -1582,10 +1582,15 @@ __PACKAGE__->register_method({
>>>       code => sub {
>>>           my ($param) = @_;
>>> +        my $timezone;
>>>           my $ctime = time();
>>>           my $ltime = timegm_nocheck(localtime($ctime));
>>> +        PVE::Tools::run_command(
>>> +            ['timedatectl', 'show', '--property=Timezone', '--value'],
>>> +            outfunc => sub { $timezone //= shift },
>>> +        );
>>>           my $res = {
>>> -            timezone => PVE::INotify::read_file('timezone'),
>>> +            timezone => $timezone,
>>>               time => $ctime,
>>>               localtime => $ltime,
>>>           };
>>> @@ -1619,7 +1624,7 @@ __PACKAGE__->register_method({
>>>       code => sub {
>>>           my ($param) = @_;
>>> -        PVE::INotify::write_file('timezone', $param->{timezone});
>>> +        PVE::Tools::run_command(['timedatectl', 'set-timezone', 
>>> $param->{timezone}]);
>>
>> should we restrict this parameter? AFAICT, only [a-zA-Z][a-zA-Z/_\-]*
>> are currently valid in timezone values?
> 
> Correct me if I'm wrong: this is already done in pve-commen:src/PVE/ 
> JSONSchema.pm: pve_verify_timezone.
> 
>> alternatively we could query the valid names first (list-timezones) and
>> then check that the passed value is contained in that set..
> 
> The current pve_verify_timezone function still uses /usr/share/zoneinfo/ 
> zone.tab which seems to be a subset of timedatectl list-timezones (418 
> vs 598 entries). That could be subject of another improvement.

vs 
https://git.proxmox.com/?p=proxmox-widget-toolkit.git;a=blob_plain;f=src/data/TimezoneStore.js;hb=HEAD 
which uses a static list instead of querying the API for valid values.

>>>           return;
>>>       },
>>> -- 
>>> 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:[~2026-01-16 21:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-25  8:05 [pve-devel] [PATCH manager/common 0/1] Fix #7175: switch API to timedatectl Stefan Mayr
2025-12-25  8:05 ` [pve-devel] [PATCH common 1/1] Fix #7175: remove deprecated timezone file Stefan Mayr
2025-12-29 12:03   ` Maximiliano Sandoval
2026-01-15 10:26     ` Fabian Grünbichler
2026-01-16 21:32       ` Stefan Mayr
2025-12-25  8:05 ` [pve-devel] [PATCH manager 1/1] Fix #7175: use timedatectl for timezone handling Stefan Mayr
2026-01-15 10:25   ` Fabian Grünbichler
2026-01-16 21:30     ` Stefan Mayr
2026-01-16 21:55       ` Stefan Mayr [this message]

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=8cfd59fe-ac2e-4d81-8fe5-c962b099f83c@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal