|
Lines 31-40
Link Here
|
| 31 |
# /usr/share/common-licenses/AGPL-3; if not, see |
31 |
# /usr/share/common-licenses/AGPL-3; if not, see |
| 32 |
# <http://www.gnu.org/licenses/>. |
32 |
# <http://www.gnu.org/licenses/>. |
| 33 |
|
33 |
|
| 34 |
import sys, string, subprocess |
34 |
import sys |
| 35 |
import univention.config_registry |
35 |
import subprocess |
|
|
36 |
from univention.config_registry import ConfigRegistry |
| 37 |
from univention.config_registry.frontend import ucr_update |
| 36 |
|
38 |
|
| 37 |
configRegistry = univention.config_registry.ConfigRegistry() |
39 |
configRegistry = ConfigRegistry(write_registry=ConfigRegistry.LDAP) |
| 38 |
configRegistry.load() |
40 |
configRegistry.load() |
| 39 |
|
41 |
|
| 40 |
found=0 |
42 |
found=0 |
|
Lines 53-76
if ldap_hostdn:
Link Here
|
| 53 |
if p1.returncode != 0: |
55 |
if p1.returncode != 0: |
| 54 |
continue |
56 |
continue |
| 55 |
|
57 |
|
|
|
58 |
updates = {} |
| 56 |
for line in result.split('\n'): |
59 |
for line in result.split('\n'): |
| 57 |
line=line.strip(' ').strip('\n') |
60 |
line=line.strip(' ').strip('\n') |
| 58 |
if line.startswith('univentionLDAPServer='): |
61 |
if line.startswith('univentionLDAPServer='): |
| 59 |
new_ldap_server=line.replace('univentionLDAPServer=', '').replace('"','') |
62 |
new_ldap_server=line.replace('univentionLDAPServer=', '').replace('"','') |
| 60 |
if not found: |
63 |
if not found: |
| 61 |
ldap_server_name = configRegistry.get('ldap/server/name') |
64 |
ldap_server_name = configRegistry.get('ldap/server/name') |
| 62 |
if not ldap_server_name: |
65 |
if not ldap_server_name or new_ldap_server != ldap_server_name: |
| 63 |
out=univention.config_registry.handler_set(['ldap/server/name=%s' % new_ldap_server]) |
66 |
updates['ldap/server/name'] = new_ldap_server |
| 64 |
elif not new_ldap_server == ldap_server_name: |
|
|
| 65 |
out=univention.config_registry.handler_set(['ldap/server/name=%s' % new_ldap_server]) |
| 66 |
found=1 |
67 |
found=1 |
| 67 |
else: |
68 |
else: |
| 68 |
addition.append(new_ldap_server) |
69 |
addition.append(new_ldap_server) |
| 69 |
if addition: |
70 |
|
| 70 |
out=univention.config_registry.handler_set(['ldap/server/addition=%s' % string.join(addition,' ')]) |
71 |
old = configRegistry.get('ldap/server/addition', '') |
| 71 |
else: |
72 |
new = ' '.join(addition) |
| 72 |
if configRegistry.get( 'ldap/server/addition' ): |
73 |
if new != old: |
| 73 |
out=univention.config_registry.handler_unset(['ldap/server/addition']) |
74 |
updates['ldap/server/addition'] = new |
|
|
75 |
|
| 76 |
if updates: |
| 77 |
ucr_update(configRegistry, updates) |
| 74 |
|
78 |
|
| 75 |
sys.exit(0) |
79 |
sys.exit(0) |
| 76 |
|
80 |
|
| 77 |
- |
|
|