Univention Bugzilla – Attachment 8311 Details for
Bug 42507
Traceback when reading pickle files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
42507-2.patch (text/plain), 1.88 KB, created by
Florian Best
on 2016-12-20 12:04 CET
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-12-20 12:04 CET
Size:
1.88 KB
patch
obsolete
>diff --git a/services/univention-ad-connector/ad-connector.py b/services/univention-ad-connector/ad-connector.py >index 24f00ff..267d082 100644 >--- a/services/univention-ad-connector/ad-connector.py >+++ b/services/univention-ad-connector/ad-connector.py >@@ -37,6 +37,7 @@ > import time > import os > import univention.debug >+import shutil > > name = 'ad-connector' > description = 'AD Connector replication' >@@ -94,28 +95,32 @@ def _dump_changes_to_file_and_check_file(directory, dn, new, old, old_dn): > > ob = (dn, new, old, old_dn) > >- filename = os.path.join(directory, "%f" % time.time()) >+ tmpdir = os.path.join(directory, 'tmp') >+ filename = '%f' % (time.time(),) >+ filepath = os.path.join(tmpdir, filename) > >- _dump_object_to_file(filename, ob) >+ _dump_object_to_file(filepath, ob) > > tmp_array = [] >- f = open(filename, 'r') >+ f = open(filepath, 'r') > tmp_array = cPickle.load(f) > f.close() > > tmp_array_len = len(tmp_array) > if tmp_array_len != 4: >- univention.debug.debug(univention.debug.LDAP, univention.debug.WARN, 'replacing broken cPickle in %s (len=%s) with plain pickle' % (filename, tmp_array_len)) >- _dump_object_to_file(filename, ob) >+ univention.debug.debug(univention.debug.LDAP, univention.debug.WARN, 'replacing broken cPickle in %s (len=%s) with plain pickle' % (filepath, tmp_array_len)) >+ _dump_object_to_file(filepath, ob) > > tmp_array = [] >- f = open(filename, 'r') >+ f = open(filepath, 'r') > tmp_array = cPickle.load(f) > f.close() > > tmp_array_len = len(tmp_array) > if tmp_array_len != 4: >- univention.debug.debug(univention.debug.LDAP, univention.debug.ERROR, 'pickle in %s (len=%s) seems to be broken' % (filename, tmp_array_len)) >+ univention.debug.debug(univention.debug.LDAP, univention.debug.ERROR, 'pickle in %s (len=%s) seems to be broken' % (filepath, tmp_array_len)) >+ >+ shutil.move(filepath, os.path.join(directory, filename)) > > > def handler(dn, new, old, command):
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 42507
:
8042
|
8054
|
8096
| 8311