summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-02-22 17:35:13 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2023-02-22 17:35:13 +0000
commitd95808b5186f1dddebf7cc9674ca655b8100a6f8 (patch)
tree9c89d4484341b1299eff9bbd2b69a66c51dfed2e
parent4f0ccab4b0b0c8bb2cdce321c6dce39bf4215ce9 (diff)
downloadvyos-1x-d95808b5186f1dddebf7cc9674ca655b8100a6f8.tar.gz
vyos-1x-d95808b5186f1dddebf7cc9674ca655b8100a6f8.zip
T5025: Fix timezones and validator use timedatectl
Fix timezones completion help and validotor Use 'timedatectl' insted of find zoneinfo
-rw-r--r--interface-definitions/system-time-zone.xml.in2
-rwxr-xr-xsrc/validators/timezone4
2 files changed, 3 insertions, 3 deletions
diff --git a/interface-definitions/system-time-zone.xml.in b/interface-definitions/system-time-zone.xml.in
index ff815c9d3..f6b291984 100644
--- a/interface-definitions/system-time-zone.xml.in
+++ b/interface-definitions/system-time-zone.xml.in
@@ -7,7 +7,7 @@
<help>Local time zone (default UTC)</help>
<priority>100</priority>
<completionHelp>
- <script>find /usr/share/zoneinfo/posix -type f -or -type l | sed -e s:/usr/share/zoneinfo/posix/:: | sort</script>
+ <script>timedatectl list-timezones</script>
</completionHelp>
<constraint>
<validator name="timezone" argument="--validate"/>
diff --git a/src/validators/timezone b/src/validators/timezone
index baf5abca2..107571181 100755
--- a/src/validators/timezone
+++ b/src/validators/timezone
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019 VyOS maintainers and contributors
+# Copyright (C) 2019-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -25,7 +25,7 @@ if __name__ == '__main__':
parser.add_argument("--validate", action="store", required=True, help="Check if timezone is valid")
args = parser.parse_args()
- tz_data = cmd('find /usr/share/zoneinfo/posix -type f -or -type l | sed -e s:/usr/share/zoneinfo/posix/::')
+ tz_data = cmd('timedatectl list-timezones')
tz_data = tz_data.split('\n')
if args.validate not in tz_data: