|
30 |
# License with the Debian GNU/Linux or Univention distribution in file |
30 |
# License with the Debian GNU/Linux or Univention distribution in file |
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 |
from warnings import filterwarnings |
34 |
filterwarnings("ignore") |
33 |
|
35 |
|
34 |
|
36 |
import sys |
35 |
import sys, string, os, time, signal, shutil |
37 |
import os |
|
|
38 |
import time |
39 |
import signal |
36 |
from optparse import OptionParser |
40 |
from optparse import OptionParser |
37 |
|
41 |
|
38 |
import fcntl |
42 |
import fcntl |
39 |
import ldap, traceback |
43 |
import ldap |
|
|
44 |
import traceback |
40 |
import univention |
45 |
import univention |
41 |
import univention.s4connector |
46 |
import univention.s4connector |
42 |
import univention.s4connector.s4 |
47 |
import univention.s4connector.s4 |
Lines 55-64
if options.configbasename:
|
Link Here
|
---|
|
55 |
CONFIGBASENAME = options.configbasename |
60 |
CONFIGBASENAME = options.configbasename |
56 |
STATUSLOGFILE = "/var/log/univention/%s-s4-status.log" % CONFIGBASENAME |
61 |
STATUSLOGFILE = "/var/log/univention/%s-s4-status.log" % CONFIGBASENAME |
57 |
|
62 |
|
58 |
sys.path=['/etc/univention/%s/s4/' % CONFIGBASENAME]+sys.path |
63 |
from imp import load_source |
59 |
|
64 |
mapping = load_source('mapping', '/etc/univention/%s/s4/mapping.py' % CONFIGBASENAME) |
60 |
|
|
|
61 |
import mapping |
62 |
|
65 |
|
63 |
|
66 |
|
64 |
def daemon(lock_file): |
67 |
def daemon(lock_file): |
Lines 146-152
def connect():
|
Link Here
|
---|
|
146 |
s4_ldap_bindpw=s4_ldap_bindpw[0:-1] |
149 |
s4_ldap_bindpw=s4_ldap_bindpw[0:-1] |
147 |
else: |
150 |
else: |
148 |
s4_ldap_bindpw=None |
151 |
s4_ldap_bindpw=None |
149 |
|
152 |
|
150 |
poll_sleep=int(baseConfig['%s/s4/poll/sleep' % CONFIGBASENAME]) |
153 |
poll_sleep=int(baseConfig['%s/s4/poll/sleep' % CONFIGBASENAME]) |
151 |
s4_init=None |
154 |
s4_init=None |
152 |
while not s4_init: |
155 |
while not s4_init: |
Lines 166-172
def connect():
|
Link Here
|
---|
|
166 |
print "Warning: Can't initialize LDAP-Connections, wait..." |
169 |
print "Warning: Can't initialize LDAP-Connections, wait..." |
167 |
sys.stdout.flush() |
170 |
sys.stdout.flush() |
168 |
time.sleep(poll_sleep) |
171 |
time.sleep(poll_sleep) |
169 |
pass |
|
|
170 |
|
172 |
|
171 |
|
173 |
|
172 |
# Initialisierung auf UCS und S4 Seite durchfuehren |
174 |
# Initialisierung auf UCS und S4 Seite durchfuehren |
Lines 179-190
def connect():
|
Link Here
|
---|
|
179 |
ucs_init=True |
181 |
ucs_init=True |
180 |
except ldap.SERVER_DOWN: |
182 |
except ldap.SERVER_DOWN: |
181 |
print "Can't contact LDAP server during ucs-poll, sync not possible." |
183 |
print "Can't contact LDAP server during ucs-poll, sync not possible." |
182 |
sys.stdout.flush() |
184 |
sys.stdout.flush() |
183 |
time.sleep(poll_sleep) |
185 |
time.sleep(poll_sleep) |
184 |
s4.open_s4() |
186 |
s4.open_s4() |
185 |
s4.open_ucs() |
187 |
s4.open_ucs() |
186 |
pass |
|
|
187 |
|
188 |
|
188 |
|
189 |
while not s4_init: |
189 |
while not s4_init: |
190 |
try: |
190 |
try: |
Lines 192-202
def connect():
|
Link Here
|
---|
|
192 |
s4_init=True |
192 |
s4_init=True |
193 |
except ldap.SERVER_DOWN: |
193 |
except ldap.SERVER_DOWN: |
194 |
print "Can't contact LDAP server during ucs-poll, sync not possible." |
194 |
print "Can't contact LDAP server during ucs-poll, sync not possible." |
195 |
sys.stdout.flush() |
195 |
sys.stdout.flush() |
196 |
time.sleep(poll_sleep) |
196 |
time.sleep(poll_sleep) |
197 |
s4.open_s4() |
197 |
s4.open_s4() |
198 |
s4.open_ucs() |
198 |
s4.open_ucs() |
199 |
pass |
|
|
200 |
|
199 |
|
201 |
f.close() |
200 |
f.close() |
202 |
retry_rejected=0 |
201 |
retry_rejected=0 |
Lines 250-256
def connect():
|
Link Here
|
---|
|
250 |
except ldap.SERVER_DOWN: |
249 |
except ldap.SERVER_DOWN: |
251 |
print "Can't contact LDAP server during resync rejected, sync not possible." |
250 |
print "Can't contact LDAP server during resync rejected, sync not possible." |
252 |
connected = False |
251 |
connected = False |
253 |
sys.stdout.flush() |
252 |
sys.stdout.flush() |
254 |
change_counter=0 |
253 |
change_counter=0 |
255 |
retry_rejected+=1 |
254 |
retry_rejected+=1 |
256 |
|
255 |
|
Lines 285-291
def main():
|
Link Here
|
---|
|
285 |
f=open(STATUSLOGFILE, 'w+') |
284 |
f=open(STATUSLOGFILE, 'w+') |
286 |
sys.stdout=f |
285 |
sys.stdout=f |
287 |
print time.ctime() |
286 |
print time.ctime() |
288 |
|
287 |
|
289 |
text = '' |
288 |
text = '' |
290 |
exc_info = sys.exc_info() |
289 |
exc_info = sys.exc_info() |
291 |
lines = apply(traceback.format_exception, exc_info) |
290 |
lines = apply(traceback.format_exception, exc_info) |
Lines 304-307
def main():
|
Link Here
|
---|
|
304 |
|
303 |
|
305 |
if __name__ == "__main__": |
304 |
if __name__ == "__main__": |
306 |
main() |
305 |
main() |
307 |
|
|
|