Fix invalid timezone

This fixes an invalid response generated by get_timezone when the time zones are composed by 3 parts, for example:

America/Argentina/Buenos_Aires
America/Indiana/Indianapolis

Update utils.py
This commit is contained in:
ejose19 2019-08-04 13:18:53 -03:00
parent a5378b5958
commit 2602df5e19

View File

@ -40,7 +40,8 @@ import qubes.exc
def get_timezone():
# fc18
if os.path.islink('/etc/localtime'):
return '/'.join(os.readlink('/etc/localtime').split('/')[-2:])
tz_path = '/'.join(os.readlink('/etc/localtime').split('/'))
return tz_path.split('zoneinfo/')[1]
# <=fc17
if os.path.exists('/etc/sysconfig/clock'):
clock_config = open('/etc/sysconfig/clock', "r")