Univention Bugzilla – Attachment 5758 Details for
Bug 34003
Committing slapd.conf is slow due to 25univention-ldap-server_local-schema
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
25univention-ldap-server_local-schema
25univention-ldap-server_local-schema (text/plain), 1.85 KB, created by
Arvid Requate
on 2014-01-28 19:40:11 CET
(
hide
)
Description:
25univention-ldap-server_local-schema
Filename:
MIME Type:
Creator:
Arvid Requate
Created:
2014-01-28 19:40:11 CET
Size:
1.85 KB
patch
obsolete
> >@!@ >import os >import os.path >import re >from univention.config_registry.handler import run_filter > >def getRegisteredFiles(): > files = [] > registeredDirectory='/etc/univention/templates/info/' > for f in os.listdir(registeredDirectory): > for line in open(os.path.join(registeredDirectory,f), 'r').readlines(): > if line.startswith('File: '): > fn = line.replace('File: ', '').strip() > if fn.startswith('etc/ldap/slapd.conf.d'): > files.append(fn) > elif line.startswith('Subfile: '): > fn = line.replace('Subfile: ', '').strip() > if fn.startswith('etc/ldap/slapd.conf.d'): > files.append(fn) > > return files > >def ucr_filter_files(registeredFiles): > directoryPath='/etc/univention/templates/files/etc/ldap/slapd.conf.d/' > > checklist = [] > for f in os.listdir(directoryPath): > if f == '25univention-ldap-server_local-schema' or f.startswith('.'): > continue > > # check if file is registered? > if not 'etc/ldap/slapd.conf.d/%s' % f in registeredFiles: > continue > > checklist.append(f) > > output="" > if checklist: > os.chdir("/etc/univention/templates/files/etc/ldap/slapd.conf.d/") > for fn in checklist: > with open(fn, 'r') as f: > output+=run_filter(f.read(), configRegistry) > return output > >def isSchemaFileIncluded(schemaFile, ucr_filtered_output): > pattern = re.compile('include.*%s' % schemaFile) > for line in ucr_filtered_output.split('\n'): > if line and pattern.match(line): > return True > > return False > > >if configRegistry.get('ldap/server/type', 'slave') == 'master': > > if os.path.exists('/var/lib/univention-ldap/local-schema'): > > registeredFiles = getRegisteredFiles() > ucr_filtered_output = ucr_filter_files(registeredFiles) > > for schemaFile in os.listdir('/var/lib/univention-ldap/local-schema'): > > if not isSchemaFileIncluded(schemaFile, ucr_filtered_output): > > print 'include /var/lib/univention-ldap/local-schema/%s' % schemaFile > >@!@
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 Raw
Actions:
View
Attachments on
bug 34003
: 5758 |
10403