Univention Bugzilla – Attachment 7905 Details for
Bug 41007
replace ssh and ldap connection to master with HTTP UMC request in schoolinstaller
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
41007.patch (text/plain), 2.12 KB, created by
Florian Best
on 2016-08-19 15:33:40 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-08-19 15:33:40 CEST
Size:
2.12 KB
patch
obsolete
>diff --git a/ucs-school-umc-installer/umc/python/schoolinstaller/__init__.py b/ucs-school-umc-installer/umc/python/schoolinstaller/__init__.py >index c4c182d..dfae54f 100644 >--- a/ucs-school-umc-installer/umc/python/schoolinstaller/__init__.py >+++ b/ucs-school-umc-installer/umc/python/schoolinstaller/__init__.py >@@ -217,12 +217,12 @@ def umc(username, password, master, path='', options=None, flavor=None, command= > > def get_user_dn(username, password, master): > """Get the LDAP DN for the given username.""" >- result = umc(username, password, master, 'udm/query', {"objectProperty": "username", "objectPropertyValue": username}, 'users/user') >- result = [ientry.get('$dn$') for ientry in result if ientry.get('username') == username] >- try: >- return result[0] >- except IndexError: >- pass >+ ssh = get_ssh_connection(username, password, master) >+ stdin, stdout, stderr = ssh.exec_command(' '.join([pipes.quote(x) for x in ['/usr/bin/sudo', '/usr/bin/univention-ldapsearch', '-LLLoldif-wrap=no', filter_format('(&(uid=%s)(objectClass=person))', [username]), 'dn']])) >+ for line in stdout.splitlines(): >+ match = re.match('^dn: (.*)\s*$', line) >+ if match: >+ return match.group(1) > > > def create_ou_local(ou, displayName): >@@ -579,6 +579,12 @@ class Instance(Base): > except univention.uldap.ldap.LDAPError as err: > MODULE.warn('LDAP connection to %s failed: %s' % (master, err)) > return {'success': False, 'error': _('The LDAP connection to the master system %s failed.') % master} >+ except socket.gaierror as exc: >+ MODULE.warn('Could not connect to master system %s: %s' % (master, exc)) >+ return {'success': False, 'error': _('Cannot connect to the master domain controller system %s. Please make sure that the system is reachable. If not this could be due to wrong DNS nameserver settings.') % master} >+ except paramiko.SSHException as exc: >+ MODULE.warn('Could not connect to master system %s: %s' % (master, exc)) >+ return {'success': False, 'error': _('Cannot connect to the master domain controller system %s. It seems that the specified domain credentials are not valid.') % master} > > return {'success': True, 'schoolinfo': values} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41007
: 7905