Explorar el Código

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
ejose19 hace 4 años
padre
commit
2602df5e19
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      qubes/utils.py

+ 2 - 1
qubes/utils.py

@@ -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")