summaryrefslogtreecommitdiff
path: root/src/validators/timezone
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-07 08:27:36 +0200
committerGitHub <noreply@github.com>2020-04-07 08:27:36 +0200
commit09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c (patch)
tree6e7b0971ecd8859cff864b3ebb37f86f8ba288f5 /src/validators/timezone
parente0f13b79a669e7fc8cadac8757b2f5fbbf51dc99 (diff)
parent7256810914e6664bf92041dcd7c3daf649ce0001 (diff)
downloadvyos-1x-09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c.tar.gz
vyos-1x-09ad28b28c9ebd9308cfe9048686b3b0ef9cfd9c.zip
Merge pull request #307 from thomas-mangin/T2226
util: T2226: convert all call to use vyos.util.{popen, cmd, run}
Diffstat (limited to 'src/validators/timezone')
-rwxr-xr-xsrc/validators/timezone8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/validators/timezone b/src/validators/timezone
index d7a8f64c4..ec845e755 100755
--- a/src/validators/timezone
+++ b/src/validators/timezone
@@ -17,12 +17,8 @@
import argparse
from sys import exit
-from subprocess import Popen, PIPE, STDOUT
-def _cmd(cmd):
- p = Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True)
- tmp = p.communicate()[0].strip()
- return tmp.decode()
+from vyos.util import cmd
parser = argparse.ArgumentParser()
parser.add_argument("--validate", action="store", help="Check if timezone is valid")
@@ -31,7 +27,7 @@ if __name__ == '__main__':
args = parser.parse_args()
if args.validate:
- tz_data = _cmd('find /usr/share/zoneinfo/posix -type f -or -type l | sed -e s:/usr/share/zoneinfo/posix/::')
+ tz_data = cmd('find /usr/share/zoneinfo/posix -type f -or -type l | sed -e s:/usr/share/zoneinfo/posix/::')
tz_data = tz_data.split('\n')
# if timezone can't be found in list it's invalid
if args.validate not in tz_data: