View | Details | Raw Unified | Return to bug 43009 | Differences between
and this patch

Collapse All | Expand All

(-)a/ucs-school-umc-installer/umc/python/schoolinstaller/__init__.py (-9 / +21 lines)
Lines 45-50 Link Here
45
import select
45
import select
46
import errno
46
import errno
47
from httplib import HTTPException
47
from httplib import HTTPException
48
from distutils.version import LooseVersion
48
49
49
import notifier
50
import notifier
50
import notifier.threads
51
import notifier.threads
Lines 352-358 def get_samba_version(self): Link Here
352
			return 3
353
			return 3
353
		return None
354
		return None
354
355
355
	def get_ucs_school_version(self):
356
	def get_ucs_school_environment(self):
356
		'''Returns 'singlemaster', 'multiserver', or None'''
357
		'''Returns 'singlemaster', 'multiserver', or None'''
357
		if self.package_manager.is_installed('ucs-school-singlemaster'):
358
		if self.package_manager.is_installed('ucs-school-singlemaster'):
358
			return 'singlemaster'
359
			return 'singlemaster'
Lines 360-365 def get_ucs_school_version(self): Link Here
360
			return 'multiserver'
361
			return 'multiserver'
361
		return None
362
		return None
362
363
364
	def get_school_version(self):
365
		return ucr.get('appcenter/apps/ucsschool/version')
366
363
	@simple_response
367
	@simple_response
364
	def query(self, **kwargs):
368
	def query(self, **kwargs):
365
		"""Returns a dictionary of initial values for the form."""
369
		"""Returns a dictionary of initial values for the form."""
Lines 369-375 def query(self, **kwargs): Link Here
369
			'server_role': ucr.get('server/role'),
373
			'server_role': ucr.get('server/role'),
370
			'joined': os.path.exists('/var/univention-join/joined'),
374
			'joined': os.path.exists('/var/univention-join/joined'),
371
			'samba': self.get_samba_version(),
375
			'samba': self.get_samba_version(),
372
			'ucsschool': self.get_ucs_school_version(),
376
			'ucsschool': self.get_ucs_school_environment(),
373
			'guessed_master': get_master_dns_lookup(),
377
			'guessed_master': get_master_dns_lookup(),
374
			'hostname': ucr.get('hostname'),
378
			'hostname': ucr.get('hostname'),
375
		}
379
		}
Lines 451-468 def _get_schoolinfo(self, school_ou): Link Here
451
			educational_slaves = [SchoolDCSlave.from_dn(dn, None, lo).name for dn in school.educational_servers]
455
			educational_slaves = [SchoolDCSlave.from_dn(dn, None, lo).name for dn in school.educational_servers]
452
			administrative_slaves = [SchoolDCSlave.from_dn(dn, None, lo).name for dn in school.administrative_servers]
456
			administrative_slaves = [SchoolDCSlave.from_dn(dn, None, lo).name for dn in school.administrative_servers]
453
457
454
		school_version = None
458
		school_environment = None
455
		for package, version in (('ucs-school-singlemaster', 'singlemaster'), ('ucs-school-slave', 'multiserver'), ('ucs-school-master', 'multiserver')):
459
		for package, version in (('ucs-school-singlemaster', 'singlemaster'), ('ucs-school-slave', 'multiserver'), ('ucs-school-master', 'multiserver')):
456
			package = self.package_manager.get_package(package)
460
			package = self.package_manager.get_package(package)
457
			if package and package.is_installed:
461
			if package and package.is_installed:
458
				school_version = version
462
				school_environment = version
459
				break
463
				break
460
464
461
		return {
465
		return {
462
			'exists': exists,
466
			'exists': exists,
463
			'school': school_ou,
467
			'school': school_ou,
464
			'samba': self.get_samba_version(),
468
			'samba': self.get_samba_version(),
465
			'school_version': school_version,
469
			'school_version': school_environment,
470
			'school_app_version': self.get_school_version(),
466
			'classShareServer': class_share_server,
471
			'classShareServer': class_share_server,
467
			'homeShareServer': home_share_server,
472
			'homeShareServer': home_share_server,
468
			'educational_slaves': educational_slaves,
473
			'educational_slaves': educational_slaves,
Lines 533-548 def install(self, request): Link Here
533
			# check for a compatible environment on the DC master
538
			# check for a compatible environment on the DC master
534
539
535
			schoolinfo = self._get_schoolinfo_from_master(username, password, master, school_ou)
540
			schoolinfo = self._get_schoolinfo_from_master(username, password, master, school_ou)
536
			school_version = schoolinfo['school_version']
541
			school_environment = schoolinfo['school_version']
537
			if not school_version:
542
			if not school_environment:
538
				raise SchoolInstallerError(_('Please install UCS@school on the master domain controller system. Cannot proceed installation on this system.'))
543
				raise SchoolInstallerError(_('Please install UCS@school on the master domain controller system. Cannot proceed installation on this system.'))
539
			if server_role == 'domaincontroller_slave' and school_version != 'multiserver':
544
			if server_role == 'domaincontroller_slave' and school_environment != 'multiserver':
540
				raise SchoolInstallerError(_('The master domain controller is not configured for a UCS@school multi server environment. Cannot proceed installation on this system.'))
545
				raise SchoolInstallerError(_('The master domain controller is not configured for a UCS@school multi server environment. Cannot proceed installation on this system.'))
541
			if server_role == 'domaincontroller_backup' and school_version != setup:
546
			if server_role == 'domaincontroller_backup' and school_environment != setup:
542
				raise SchoolInstallerError(_('The UCS@school master domain controller needs to be configured similarly to this backup system. Please choose the correct environment type for this system.'))
547
				raise SchoolInstallerError(_('The UCS@school master domain controller needs to be configured similarly to this backup system. Please choose the correct environment type for this system.'))
543
			if server_role == 'domaincontroller_backup' and not joined:
548
			if server_role == 'domaincontroller_backup' and not joined:
544
				raise SchoolInstallerError(_('In order to install UCS@school on a backup domain controller, the system needs to be joined first.'))
549
				raise SchoolInstallerError(_('In order to install UCS@school on a backup domain controller, the system needs to be joined first.'))
545
550
551
			school_version = schoolinfo.get('school_app_version')
552
			local_school_version = self.get_school_version()
553
			if not school_version or LooseVersion(school_version) < LooseVersion(local_school_version):
554
				if not ucr.is_true('ucsschool/join/ignore-version-mismatch/%s/%s' % (school_version, local_school_version)):
555
					raise SchoolInstallerError(_('The version of the UCS@school app on the DC master is lower than the version on this host. Please consult the Univention Support Database on how to proceed: http://sdb.univention.de/1373'))
556
				MODULE.warn('Ignoring UCS@school version mismatch: Master: %s; Local: %s;' % (school_version, local_school_version))
557
546
		# everything ok, try to acquire the lock for the package installation
558
		# everything ok, try to acquire the lock for the package installation
547
		lock_aquired = self.package_manager.lock(raise_on_fail=False)
559
		lock_aquired = self.package_manager.lock(raise_on_fail=False)
548
		if not lock_aquired:
560
		if not lock_aquired:

Return to bug 43009