Univention Bugzilla – Bug 57262
univention-directory-reports-cleanup does not cleanup all files
Last modified: 2024-05-07 16:15:30 CEST
.csv files are not deleted. ```diff - if not f.startswith('univention-directory-reports-') or not f.endswith('.pdf'): + if not f.startswith('univention-directory-reports-') or not f.endswith(('.csv', '.pdf')): ``` modern UCR: ```diff -import univention.config_registry as ucr - - -configRegistry = ucr.ConfigRegistry() -configRegistry.load() +from univention.config_registry import ucr as configRegisty ``` ```diff -max_age = int(configRegistry.get('directory/reports/cleanup/age', '43200')) +max_age = configRegistry.get_int('directory/reports/cleanup/age', 43200) ``` Useless collection in list: ```diff -old = [] … age = now - creation_date if age > max_age: - old.append(f) - -if old: - for f in old: os.unlink(os.path.join(dirname, f)) ``` PS: files should be moved from /usr/share/univention-management-console-module-udm/ to /var/spool/univention-management-console-module-umd/ or similar.