View | Details | Raw Unified | Return to bug 39069
Collapse All | Expand All

(-)umc/python/adtakeover/takeover.py (-2 / +8 lines)
 Lines 62-67    Link Here 
62
import univention.lib
62
import univention.lib
63
import univention.lib.s4
63
import univention.lib.s4
64
from datetime import datetime, timedelta
64
from datetime import datetime, timedelta
65
import locale
65
import univention.config_registry
66
import univention.config_registry
66
# from samba.netcmd.common import netcmd_get_domain_infos_via_cldap
67
# from samba.netcmd.common import netcmd_get_domain_infos_via_cldap
67
from samba.dcerpc import nbt
68
from samba.dcerpc import nbt
 Lines 801-810    Link Here 
801
			return False
802
			return False
802
803
803
		TIME_FORMAT = "%a %b %d %H:%M:%S %Z %Y"
804
		TIME_FORMAT = "%a %b %d %H:%M:%S %Z %Y"
805
		time_string = stdout.strip()
806
		old_locale = locale.getlocale(locale.LC_TIME)
804
		try:
807
		try:
805
			remote_datetime = datetime.strptime(stdout.strip(), TIME_FORMAT)
808
			locale.setlocale(locale.LC_TIME, (None, None)) # 'C' as env['LC_ALL'] some lines earlier
809
			remote_datetime = datetime.strptime(time_string, TIME_FORMAT)
806
		except ValueError as ex:
810
		except ValueError as ex:
807
			raise TimeSynchronizationFailed(_("AD Server did not return proper time string: %s.") % (stdout.strip(),))
811
			raise TimeSynchronizationFailed(_("AD Server did not return proper time string: %s.") % (time_string,))
812
		finally:
813
			locale.setlocale(locale.LC_TIME, old_locale)
808
814
809
		local_datetime = datetime.today()
815
		local_datetime = datetime.today()
810
		delta_t = local_datetime - remote_datetime
816
		delta_t = local_datetime - remote_datetime

Return to bug 39069