Univention Bugzilla – Attachment 8118 Details for
Bug 34916
Directory-logger: Traceback delist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
34916.diff
file_34916.txt (text/plain), 6.81 KB, created by
Philipp Hahn
on 2016-10-17 14:31 CEST
(
hide
)
Description:
34916.diff
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2016-10-17 14:31 CEST
Size:
6.81 KB
patch
obsolete
>diff --git a/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/directory_logger.py b/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/directory_logger.py >index 24d29d7..5572a53 100755 >--- a/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/directory_logger.py >+++ b/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/directory_logger.py >@@ -40,7 +40,6 @@ import base64 > import grp > import subprocess > import os >-import fcntl > > import univention.debug > import univention.misc >@@ -112,51 +111,25 @@ def filterOutUnchangedAttributes(old_copy, new_copy): > > def process_dellog(dn): > dellog = listener.configRegistry['ldap/logging/dellogdir'] >- lockfilename = dellog + '.lock' >- lock = open(lockfilename, "w") >- fcntl.flock(lock, fcntl.LOCK_EX) >- try: >- dellist = os.listdir(dellog) >- dellist.sort() >- filename = dellist.pop(0) >- filename = os.path.join(dellog, filename) >- f = open(filename) >- (dellog_stamp, dellog_id, dellog_dn, dellog_bindDN, dellog_action) = [line.rstrip() for line in f] >- f.close() >- if dellog_dn != dn: > >- # first clean up the mess: >- leftover = 1 >- if cleanupDellog: >- os.unlink(filename) >- >- # be nice: see if we can find dn in a later entry >- for filename in dellist: >- filename = os.path.join(dellog, filename) >- f = open(filename) >- (dellog_stamp, dellog_id, dellog_dn, dellog_bindDN, dellog_action) = [line.rstrip() for line in f] >- f.close() >- if dellog_dn == dn: >- univention.debug.debug(univention.debug.LISTENER, univention.debug.WARN, '%s: dn found in dellog entry %s, ID %s (+%s)' % (name, filename, dellog_id, leftover)) >- break >- # damn, missed that one as well. Now it's too late, clean up: >- leftover += 1 >- if cleanupDellog: >- os.unlink(filename) >- >- if dellog_dn == dn: # haben wir's jetzt? >- timestamp = ldapTime2string(dellog_stamp) >- modifier = dellog_bindDN >- action = dellog_action >- os.unlink(filename) >- else: >- univention.debug.debug(univention.debug.LISTENER, univention.debug.ERROR, '%s: dn not found in dellog: %s' % (name, dn)) >+ dellist = os.listdir(dellog) >+ dellist.sort() >+ for leftover, filename in enumerate(dellist): >+ pathname = os.path.join(dellog, filename) >+ try: >+ with open(pathname, 'r') as f: >+ (dellog_stamp, dellog_id, dellog_dn, modifier, action) = [line.rstrip() for line in f] > >- finally: >- fcntl.flock(lock, fcntl.LOCK_UN) >- os.unlink(lockfilename) >+ if cleanupDellog: >+ os.unlink(pathname) >+ except EnvironmentError: >+ continue > >- if not modifier: # Fallback >+ if dellog_dn == dn: >+ univention.debug.debug(univention.debug.LISTENER, univention.debug.WARN, '%s: dn found in dellog entry %s, ID %s (+%s)' % (name, filename, dellog_id, leftover)) >+ timestamp = ldapTime2string(dellog_stamp) >+ break >+ else: > timestamp = time.strftime(timestampfmt, time.gmtime()) > dellog_id = '<NoID>' > modifier = '<unknown>' >diff --git a/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postinst b/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postinst >index 48b1719..6715d82 100644 >--- a/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postinst >+++ b/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postinst >@@ -33,39 +33,22 @@ > #DEBHELPER# > > registrySection='ldap/logging' >-workdir=/var/lib/univention-directory-logger >-dellog=${workdir}/dellog >+workdir='/var/lib/univention-directory-logger' >+dellog="${workdir}/dellog" > >-[ -d "${workdir}" ] || /bin/mkdir -p "${workdir}" >- >-if [ -d "${dellog}" ]; then >- /bin/rm -rf "${dellog}" >- /bin/rm -f "${dellog}".lock >- dpkg-statoverride --remove --force "${dellog}" >-fi >- >-/bin/mkdir -p "${dellog}" >-dpkg-statoverride --add --update root adm 700 "${dellog}" >- >-# if [ "$1" = "configure" -a -z "$2" ]; then # only do this at installation time, not on update > if [ "$1" = "configure" ]; then >- ## set config-registry vriables >- univention-config-registry set "${registrySection}"?yes >- univention-config-registry set "${registrySection}/dellogdir"?"${dellog}" >+ install -m 0700 -o root -g adm -d "$workdir" >+ install -m 0700 -o root -g adm -d "$dellog" > >- ## commit the changes to slapd.conf multifile >- univention-config-registry commit /etc/ldap/slapd.conf >- >- ## restart the OpenLDAP Server to load the module >- /etc/init.d/slapd crestart >- >- # exclude temporary objects by default > eval "$(univention-config-registry shell ldap/base)" >- univention-config-registry set "${registrySection}/exclude1"?"cn=temporary,cn=univention,$ldap_base" >- >- ## load the listener module >- /etc/init.d/univention-directory-listener crestart >+ univention-config-registry set \ >+ "${registrySection}?yes" \ >+ "${registrySection}/dellogdir?${dellog}" \ >+ "${registrySection}/exclude1?cn=temporary,cn=univention,$ldap_base" > >+ univention-config-registry commit /etc/ldap/slapd.conf >+ invoke-rc.d slapd crestart >+ invoke-rc.d univention-directory-listener crestart > fi > > exit 0 >diff --git a/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postrm b/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postrm >index c16c4fb..8eebea5 100644 >--- a/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postrm >+++ b/branches/ucs-4.1/ucs-4.1-3/management/univention-directory-logger/debian/univention-directory-logger.postrm >@@ -33,30 +33,20 @@ > #DEBHELPER# > > registrySection='ldap/logging' >-workdir=/var/lib/univention-directory-logger >-dellog=${workdir}/dellog >+workdir='/var/lib/univention-directory-logger' >+dellog="${workdir}/dellog" > > case "$1" in > "remove") >- ## unload the listener module >- /etc/init.d/univention-directory-listener crestart >- >- ## unset directory variable, to stop dellog template activation >- univention-config-registry unset "${registrySection}/dellogdir" >- >- ## commit the changes to slapd.conf multifile >+ univention-config-registry unset \ >+ "${registrySection}/dellogdir" \ >+ "${registrySection}" >+ invoke-rc.d univention-directory-listener crestart > univention-config-registry commit /etc/ldap/slapd.conf >- >- ## restart the OpenLDAP Server to unload the overlay >- /etc/init.d/slapd crestart >- >- ## unset main ucr variable >- univention-config-registry unset "${registrySection}" >- >- dpkg-statoverride --remove --force "${dellog}" >- >- rm -rf "${dellog}" >- rm -f "${dellog}".lock >+ invoke-rc.d slapd crestart >+ ;; >+ "upgrade") >+ dpkg-statoverride --force --quiet --remove "${dellog}" > ;; > "purge") > rm -rf "${workdir}"
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 34916
: 8118