Sunil Mohan Adapa f9fd1b142a
datetime: Use privileged decorator for actions
Tests:

- Setting timezone shows:
  - In the interface and
  - timedatectl

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:51:45 -04:00

14 lines
353 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""Set time zone with timedatectl."""
import subprocess
from plinth.actions import privileged
@privileged
def set_timezone(timezone: str):
"""Set time zone with timedatectl."""
command = ['timedatectl', 'set-timezone', timezone]
subprocess.run(command, stdout=subprocess.DEVNULL, check=True)