Bug 57262 - univention-directory-reports-cleanup does not cleanup all files
univention-directory-reports-cleanup does not cleanup all files
Status: NEW
Product: UCS
Classification: Unclassified
Component: UMC - Reports
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2024-05-07 16:15 CEST by Philipp Hahn
Modified: 2024-05-07 16:15 CEST (History)
0 users

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.046
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): bitesize
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 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.