Bug 54074 - OX scripts not migrated to Python 3
OX scripts not migrated to Python 3
Status: CLOSED FIXED
Product: Z_Internal OX development
Classification: Unclassified
Component: Generic
UCS 5.0 / 7.10.5
Other Linux
: P5 normal (vote)
: 7.10.5-ucs4
Assigned To: Alexander Steffen
Tobias Wenzel
: python3-migration
Depends on: 54073 53755
Blocks: 54332
  Show dependency treegraph
 
Reported: 2021-11-16 15:24 CET by Daniel Tröder
Modified: 2022-05-09 12:02 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.229
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2021-11-16 15:24:57 CET
At least the spamrunner script was not migrated:

root@ucsl-02:~# python3 /usr/sbin/spamrunner
Traceback (most recent call last):
  File "/usr/sbin/spamrunner", line 207, in <module>
    if not os.path.exists('%s/Maildir' % (get_user_home(user["send_addr"],))):
  File "/usr/sbin/spamrunner", line 102, in get_user_home
    return read_from_ext_proc(cmd)
  File "/usr/sbin/spamrunner", line 90, in read_from_ext_proc
    syslog.syslog(syslog.LOG_ERR, cmd_err)
TypeError: [priority,] message string
Comment 2 Alexander Steffen univentionstaff 2022-01-05 13:21:18 CET
Issue:
TypeError occures when syslog should be written (caused by python3 migration)


Fix:
incrementing used interpreter version to 3.7
converted "cmd_err" from bytestring to string

requesting QA
Comment 3 Tobias Wenzel univentionstaff 2022-01-13 10:45:04 CET
QA -> Reopen

code review:

use 

#!/usr/bin/python3 instead of python3.7

aside from that the code looks good.
Comment 4 Alexander Steffen univentionstaff 2022-01-31 10:00:40 CET
issue:
see "Description"

fix:
changed used pythonversion from 3.7 to 3,
fixed verbose option


fixed with:
asteffen/54074-OX-scripts-not-migrated-to-python3
 
requesting QA
Comment 5 Alexander Steffen univentionstaff 2022-01-31 11:01:12 CET
adopted suggested stringhandling by tobias wenzel
Comment 6 Tobias Wenzel univentionstaff 2022-01-31 13:47:50 CET
QA: 

I hadn't seen, that `strip` was used there before. Simply replace (your) `rstrip` with `strip` (-> `(cmd_out.decode("utf-8").strip()`).


The rest looks good and has been tested by running the script with and without parameters.

```
ucr get server/role 
domaincontroller_slave

UCS: 5.0-1 errata199
Installed: mailserver=12.0 oxseforucs=7.10.5-ucs4
```


Then you can squash your commits, merge to `5.0` and build.

```
[asteffen/54074-OX-scripts-not-migrated-to-python3] d848a483 Bug #54074: changed string processing to a more adequat solution
[asteffen/54074-OX-scripts-not-migrated-to-python3] d44fb93f Bug #54074: fixed migration errors of spamrunners verbose option
[asteffen/54074-OX-scripts-not-migrated-to-python3] dfb6046e Bug 54074 - changed used python version from 2.7 to 3.7, converted cmr_err bytestring to string
```

afterwards, set the bug to resolved/fixed (we don't use moved here).
Comment 7 Alexander Steffen univentionstaff 2022-02-03 12:35:55 CET
Successful build
Package: univention-mail-dovecot-ox
Version: 4.0.0-12A~5.0.0.202202031235
Branch: ucs_5.0-0
Scope: oxse4ucs

merged and built
Comment 8 Florian Best univentionstaff 2022-02-03 12:53:24 CET
REOPEN:

https://git.knut.univention.de/univention/open-xchange/appsuite/-/commit/a1c5c3578225be7b3eaded7a3beabf13ec8110c7#note_52238

A merge request workflow would help here.
Comment 9 Tobias Wenzel univentionstaff 2022-02-07 10:39:39 CET
Thanks for the remarks!

5.0 - Bug #54074: fixed remaining migration error

Successful build
Package: univention-mail-dovecot-ox
Version: 4.0.0-13A~5.0.0.202202071033
Branch: ucs_5.0-0
Scope: oxse4ucs
Comment 10 Florian Best univentionstaff 2022-05-06 14:52:36 CEST
The commits so far were:

univention-mail-dovecot-ox.yaml
43da0191d0df | Bug #54074: changelog

univention-mail-dovecot-ox (4.0.0-13)
a438f30341d7 | Bug #54074: fixed remaining migration error

univention-mail-dovecot-ox (4.0.0-12)
008032c1ecd9 | Bug #54074: changelog

univention-mail-dovecot-ox (4.0.0-11)
a1c5c3578225 | Bug #54074: migrated spamrunner to python3


I added another one:

univention-mail-dovecot-ox (4.0.1-2)
8ce8291a5df1 | Bug #54074: make spamrunner code style PEP8 compatible
Comment 11 Tobias Wenzel univentionstaff 2022-05-09 11:50:05 CEST
I'm very sorry for letting you wait and thank's a lot for the changes you commited.

I tested the script again -> all ok

already built in main branch

Successful build
Package: univention-mail-dovecot-ox
Version: 4.0.1-1A~5.0.0.202205061437
Branch: ucs_5.0-0
Scope: oxse4ucs

all ok -> verify
Comment 12 Dirk Wiesenthal univentionstaff 2022-05-09 12:02:59 CEST
Released in already published 7.10.5-ucs4 in an emergency update due to Bug#54723