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

(-)src/wsgi.py (-2 / +24 lines)
 Lines 4-11    Link Here 
4
import subprocess
4
import subprocess
5
import json
5
import json
6
import re
6
import re
7
from ldif import LDIFParser
7
from univention.config_registry import ConfigRegistry
8
from univention.config_registry import ConfigRegistry
8
9
10
class LicenseLDIF(LDIFParser):
11
	def __init__(self, input, ucr):
12
		LDIFParser.__init__(self, input)
13
		self.ucr = ucr
14
		self.uuid = None
15
16
	@property
17
	def uuid(self):
18
		return self.uuid
19
20
	def handle(self, dn, entry):
21
		if dn == 'cn=admin,cn=license,cn=univention,%s' % self.ucr.get('ldap/base'):
22
			if 'univentionLicenseKeyID' in entry and len(entry['univentionLicenseKeyID']) > 0:
23
				self.uuid = entry['univentionLicenseKeyID'][0]
24
25
9
ucr = ConfigRegistry()
26
ucr = ConfigRegistry()
10
ucr.load()
27
ucr.load()
11
28
 Lines 97-110    Link Here 
97
			'message': exc.output
114
			'message': exc.output
98
		})
115
		})
99
116
117
	ucr.load()
118
119
	# get uuid from ldif file, ucr['uuid/license'] is not yet up-to-date at this point
120
	license_ldif = LicenseLDIF(open(LICENSE_UPLOAD_PATH, 'rb'), ucr)
121
	license_ldif.parse()
122
100
	# disable system activation service (stop is executed with a small delay)
123
	# disable system activation service (stop is executed with a small delay)
101
	# and answer request
124
	# and answer request
102
	ucr.load()
103
	apps = get_installed_apps()
125
	apps = get_installed_apps()
104
	subprocess.Popen(['/usr/bin/sudo', '/usr/sbin/univention-system-activation', 'stop'], stderr=subprocess.STDOUT)
126
	subprocess.Popen(['/usr/bin/sudo', '/usr/sbin/univention-system-activation', 'stop'], stderr=subprocess.STDOUT)
105
	return _finish('200 OK', {
127
	return _finish('200 OK', {
106
		'success': True,
128
		'success': True,
107
		'uuid': ucr.get('uuid/license', ''),
129
		'uuid': license_ldif.uuid,
108
		'apps': apps,
130
		'apps': apps,
109
	})
131
	})
110
132

Return to bug 39395