*** app_center.py 2015-05-21 15:56:21.320845347 +0200 --- /home/akramer/app_center.py 2015-06-05 14:14:32.655432846 +0200 *************** *** 88,93 **** --- 88,112 ---- ucr = ConfigRegistry() ucr.load() + _ldap_position = None + _ldap_connection = None + + def get_ldap_connection(ldap_master=True): + global _ldap_connection, _ldap_position + if not _ldap_position or not _ldap_connection: + _ldap_connection, _ldap_position = admin_uldap.getMachineConnection(ldap_master=ldap_master) + return _ldap_connection, _ldap_position + + + _last_ucr_reload = time.time() + + def reload_ucr(): + global ucr, _last_ucr_reload + if time.time() - _last_ucr_reload > 0.100: + ucr.load() + _last_ucr_reload = time.time() + + _ = umc.Translation('univention-management-console-module-appcenter').translate class License(object): *************** *** 104,110 **** # last time we checked, no uuid was found # but maybe the user installed a new license? try: ! _lo = uldap.getMachineConnection(ldap_master=False) data = _lo.search('objectClass=univentionLicense') del _lo self.uuid = data[0][1]['univentionLicenseKeyID'][0] --- 123,130 ---- # last time we checked, no uuid was found # but maybe the user installed a new license? try: ! #_lo = uldap.getMachineConnection(ldap_master=False) ! _lo, _po = get_ldap_connection(ldap_master=False) data = _lo.search('objectClass=univentionLicense') del _lo self.uuid = data[0][1]['univentionLicenseKeyID'][0] *************** *** 918,924 **** return ret def to_dict(self, package_manager, domainwide_managed=None, hosts=None): ! ucr.load() res = copy.copy(self._options) res['component_id'] = self.component_id --- 938,944 ---- return ret def to_dict(self, package_manager, domainwide_managed=None, hosts=None): ! reload_ucr() res = copy.copy(self._options) res['component_id'] = self.component_id *************** *** 937,942 **** --- 957,963 ---- res['umc_module'] = 'apps' res['umc_flavor'] = self.id ldap_object = self.get_ldap_object() + #ldap_object = None if ldap_object is None: res['is_installed_anywhere'] = False else: *************** *** 1293,1299 **** if ldap_id is None: ldap_id = self.ldap_id try: ! lo, pos = admin_uldap.getMachineConnection() except IOError: # /etc/machine.secret => No LDAP set up yet (e.g. system-setup) return None co = None #univention.admin.config.config(ucr.get('ldap/server/name')) --- 1314,1321 ---- if ldap_id is None: ldap_id = self.ldap_id try: ! #lo, pos = admin_uldap.getMachineConnection() ! lo, pos = get_ldap_connection() except IOError: # /etc/machine.secret => No LDAP set up yet (e.g. system-setup) return None co = None #univention.admin.config.config(ucr.get('ldap/server/name'))