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

(-)umc/python/setup/util.py (-8 / +19 lines)
 Lines 58-64    Link Here 
58
from univention.management.console.log import MODULE
58
from univention.management.console.log import MODULE
59
from univention.management.console.modules import UMC_Error
59
from univention.management.console.modules import UMC_Error
60
from univention.lib.admember import lookup_adds_dc, check_connection, check_ad_account, do_time_sync, connectionFailed, failedADConnect, notDomainAdminInAD
60
from univention.lib.admember import lookup_adds_dc, check_connection, check_ad_account, do_time_sync, connectionFailed, failedADConnect, notDomainAdminInAD
61
from univention.lib.umc import Client, ConnectionError, HTTPError
62
61
63
# FIXME: this triggers imports from univention-lib during build time test execution.
62
# FIXME: this triggers imports from univention-lib during build time test execution.
64
# This in effect imports univention-ldap which is not an explicit dependency for
63
# This in effect imports univention-ldap which is not an explicit dependency for
 Lines 1091-1105    Link Here 
1091
	if not fqdn_master:
1090
	if not fqdn_master:
1092
		return False
1091
		return False
1093
1092
1094
	try:
1093
	# The to be joined server doesn't trust the self signed certificate yet.
1095
		client = Client(fqdn_master, username, password)
1094
	# That means umc_command fails with an ssl error.
1096
		result = client.umc_command('udm/license/info').result
1095
	# Using univention-ssh to use umc_command on the master gets around that.
1097
	except (HTTPError, ConnectionError) as exc:
1096
	remote_python_command = '''
1098
		raise UMC_Error(str(exc))
1097
	"'from univention.lib.umc import Client; client = Client(\\"{fqdn_master}\\", \\"{username}\\", \\"{password}\\"); result = client.umc_command(\\"udm/license/info\\").result; print(bool(result.get(\\"keyID\\")));'"
1098
'''.format(fqdn_master=fqdn_master, username=username, password=password)
1099
	with _temporary_password_file(password) as password_file:
1100
		try:
1101
			license_status = subprocess.check_output([
1102
				'univention-ssh',
1103
				password_file,
1104
				'%s@%s' % (username, fqdn_master),
1105
				'python',
1106
				'-c',
1107
				remote_python_command
1108
				])
1109
		except subprocess.CalledProcessError:
1110
			raise UMC_Error("Can't check license on master")
1111
	return license_status == 'True\n'
1099
1112
1100
	return bool(result.get('keyID'))
1101
1113
1102
1103
def check_credentials_ad(nameserver, address, username, password):
1114
def check_credentials_ad(nameserver, address, username, password):
1104
	try:
1115
	try:
1105
		ad_domain_info = lookup_adds_dc(address, ucr={'nameserver1': nameserver})
1116
		ad_domain_info = lookup_adds_dc(address, ucr={'nameserver1': nameserver})

Return to bug 44995