Bug 51006 - Migrate templates from univention-base to Python3 and keep them Python2 compatible
Migrate templates from univention-base to Python3 and keep them Python2 compa...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: univention-base-files
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-4-errata
Assigned To: Max Pohle
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-03-25 11:28 CET by Max Pohle
Modified: 2020-06-24 12:52 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
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 Max Pohle univentionstaff 2020-03-25 11:28:19 CET
The templates should be migrated in such a way, that they remain backward compatible with python2.
Comment 1 Max Pohle univentionstaff 2020-03-25 11:34:09 CET
QA took place on a branch
Now merged to the current master 4.4-4
Comment 2 Florian Best univentionstaff 2020-03-25 11:48:28 CET
Can you make your scripts/plugins somewhere publicy available?
Comment 3 Julia Bremer univentionstaff 2020-03-26 11:08:20 CET
Changes are OK, 
package has not been built, and no yaml has been created.
Comment 4 Max Pohle univentionstaff 2020-03-26 12:02:13 CET
Package was build and yaml release file now exists.
Comment 5 Julia Bremer univentionstaff 2020-03-26 13:31:49 CET
Changes: OK
Package built: OK
yaml: OK

I changed the description in the advisory a bit.
8600a6bc36 Bug #51006: Adjust yaml

Verified
Comment 6 Max Pohle univentionstaff 2020-03-27 15:55:43 CET
@Florian: The Vim plugin was made internally available. It can be tested quality approved and possibly published after that. Search for 'vim-ucr-template'.
Comment 7 Florian Best univentionstaff 2020-03-27 22:46:07 CET
base/univention-base-files/conffiles/etc/rsyslog.conf:  print()

in python 2 this print() causes the output:
>>> print()
()
Comment 8 Florian Best univentionstaff 2020-03-27 22:47:34 CET
Philipp fixed a few things:

univention-base-files (8.0.0-6)
7fb286f35ea6 | Bug #51006 base: Fix sys.stderr change
5c8f268e4b77 | Bug #51006 base: Fix Python 3 change
Comment 9 Max Pohle univentionstaff 2020-05-04 10:31:54 CEST
Fixed print() in cb3a264541773737966392707b9bc76a2dc48910

fix: 8.0.0-7A~4.4.4.202005041029
Comment 10 Julia Bremer univentionstaff 2020-05-04 11:28:34 CEST
Changes: OK
Yaml: OK
Package install: OK

Verified
Comment 11 Florian Best univentionstaff 2020-05-04 14:28:34 CEST
I see one error and a lot of styling issues in the package:
error:
E 0020-F821: conffiles/etc/ssh/sshd_config:34:17: undefined name 'protocols'

styling:
E 0020-E225: conffiles/etc/modules:5:9: missing whitespace around operator                    
E 0020-E225: conffiles/etc/resolv.conf:5:7: missing whitespace around operator                      
E 0020-E225: conffiles/etc/resolv.conf:9:8: missing whitespace around operator
E 0020-E225: conffiles/etc/resolv.conf:12:8: missing whitespace around operator
E 0020-E226: conffiles/etc/resolv.conf:15:17: missing whitespace around arithmetic operator
E 0020-E226: conffiles/etc/resolv.conf:18:22: missing whitespace around arithmetic operator
E 0020-E226: conffiles/etc/resolv.conf:20:22: missing whitespace around arithmetic operator
E 0020-E226: conffiles/etc/resolv.conf:22:22: missing whitespace around arithmetic operator        
E 0020-E225: conffiles/etc/locale.gen:17:3: missing whitespace around operator                                           
E 0020-E303: conffiles/etc/issue.net:3:1: too many blank lines (3)
E 0020-E225: conffiles/etc/issue.net:4:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue.net:6:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue.net:8:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue.net:10:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue.net:12:11: missing whitespace around operator                               
E 0020-E225: conffiles/etc/issue.net:14:11: missing whitespace around operator                
E 0020-E225: conffiles/etc/issue.net:16:11: missing whitespace around operator
E 0020-E302: conffiles/etc/rsyslog.conf:105:1: expected 2 blank lines, found 0
E 0020-E305: conffiles/etc/rsyslog.conf:111:1: expected 2 blank lines after class or function definition, found 1
E 0020-E305: conffiles/etc/rsyslog.conf:163:1: expected 2 blank lines after class or function definition, found 1
E 0020-W291: conffiles/etc/rsyslog.conf:190:2: trailing whitespace
E 0020-E303: conffiles/etc/welcome.msg:3:1: too many blank lines (3)
E 0020-E225: conffiles/etc/welcome.msg:4:11: missing whitespace around operator
E 0020-E225: conffiles/etc/welcome.msg:6:11: missing whitespace around operator
E 0020-E225: conffiles/etc/welcome.msg:8:11: missing whitespace around operator
E 0020-E225: conffiles/etc/welcome.msg:10:11: missing whitespace around operator
E 0020-E225: conffiles/etc/welcome.msg:12:11: missing whitespace around operator
E 0020-E225: conffiles/etc/welcome.msg:14:11: missing whitespace around operator
E 0020-E225: conffiles/etc/welcome.msg:16:11: missing whitespace around operator
W 0020-E402: conffiles/etc/e2fsck.conf:7:1: module level import not at top of file
W 0020-E402: conffiles/etc/e2fsck.conf:10:1: module level import not at top of file
E 0020-E302: conffiles/etc/e2fsck.conf:13:1: expected 2 blank lines, found 1
E 0020-E305: conffiles/etc/e2fsck.conf:20:1: expected 2 blank lines after class or function definition, found 1
W 0020-E402: conffiles/etc/e2fsck.conf:29:1: module level import not at top of file
E 0020-E303: conffiles/etc/issue:3:1: too many blank lines (3)
E 0020-E225: conffiles/etc/issue:4:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue:6:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue:8:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue:10:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue:12:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue:14:11: missing whitespace around operator
E 0020-E225: conffiles/etc/issue:16:11: missing whitespace around operator
E 0020-E302: conffiles/etc/cron.d/univention-ucr-cronjobs:7:1: expected 2 blank lines, found 0
E 0020-E305: conffiles/etc/cron.d/univention-ucr-cronjobs:45:1: expected 2 blank lines after class or function definition, found 1
E 0020-E302: conffiles/etc/network/interfaces.d/10-default:6:1: expected 2 blank lines, found 1
E 0020-E305: conffiles/etc/network/interfaces.d/10-default:14:1: expected 2 blank lines after class or function definition, found 0
E 0020-E302: conffiles/etc/network/interfaces.d/10-default:16:1: expected 2 blank lines, found 1
W 0020-E126: conffiles/etc/network/interfaces.d/10-default:26:6: continuation line over-indented for hanging indent
W 0020-E126: conffiles/etc/network/interfaces.d/10-default:50:7: continuation line over-indented for hanging indent
E 0020-E302: conffiles/etc/network/interfaces.d/10-default:66:1: expected 2 blank lines, found 1
E 0020-E502: conffiles/etc/network/interfaces.d/10-default:79:83: the backslash is redundant between brackets
W 0020-E128: conffiles/etc/network/interfaces.d/10-default:80:6: continuation line under-indented for visual indent
E 0020-E502: conffiles/etc/network/interfaces.d/10-default:84:74: the backslash is redundant between brackets
W 0020-E128: conffiles/etc/network/interfaces.d/10-default:85:6: continuation line under-indented for visual indent
W 0020-E126: conffiles/etc/network/interfaces.d/10-default:121:8: continuation line over-indented for hanging indent
E 0020-E302: conffiles/etc/network/interfaces.d/10-default:136:1: expected 2 blank lines, found 1
E 0020-E305: conffiles/etc/network/interfaces.d/10-default:142:1: expected 2 blank lines after class or function definition, found 1
W 0020-E402: conffiles/etc/ssh/sshd_config:29:1: module level import not at top of file
E 0020-F821: conffiles/etc/ssh/sshd_config:34:17: undefined name 'protocols'
E 0020-E502: conffiles/etc/ssh/sshd_config:134:81: the backslash is redundant between brackets
E 0020-E101: conffiles/etc/ssh/sshd_config:135:4: indentation contains mixed spaces and tabs
W 0020-E128: conffiles/etc/ssh/sshd_config:135:17: continuation line under-indented for visual indent
E 0020-E502: conffiles/etc/ssh/sshd_config:198:63: the backslash is redundant between brackets
W 0020-E128: conffiles/etc/ssh/sshd_config:199:4: continuation line under-indented for visual indent
E 0020-E502: conffiles/etc/ssh/sshd_config:205:66: the backslash is redundant between brackets
W 0020-E128: conffiles/etc/ssh/sshd_config:206:4: continuation line under-indented for visual indent
E 0020-E502: conffiles/etc/ssh/sshd_config:212:65: the backslash is redundant between brackets
W 0020-E128: conffiles/etc/ssh/sshd_config:213:4: continuation line under-indented for visual indent
E 0020-E502: conffiles/etc/ssh/sshd_config:280:56: the backslash is redundant between brackets
W 0020-E128: conffiles/etc/ssh/sshd_config:281:4: continuation line under-indented for visual indent
E 0020-E201: conffiles/etc/ssh/ssh_config:47:23: whitespace after '('
E 0020-E202: conffiles/etc/ssh/ssh_config:47:42: whitespace before ')'
E 0020-E201: conffiles/etc/ssh/ssh_config:47:50: whitespace after '('
E 0020-E202: conffiles/etc/ssh/ssh_config:47:57: whitespace before ')'
E 0020-E111: conffiles/etc/ssh/ssh_config:48:4: indentation is not a multiple of four
E 0020-W291: conffiles/etc/logrotate.d/univention-config-registry-replog:15:14: trailing whitespace
E 0020-E101: conffiles/etc/logrotate.d/univention-config-registry-replog:21:1: indentation contains mixed spaces and tabs
Comment 12 Max Pohle univentionstaff 2020-05-06 12:26:32 CEST
Hi Florian!

I have pushed these two branches to the repository for you to review:
  mpohle/bug-51006-sshd_config
  mpohle/bug-51006-styling

I backported the original solution to the error from an old commit. The feature in sshd is deprecated, but will now again work as it used to (even though it has no effect any more because nobody can enforce ssh version 1)

By using a falke8 plugin in the editor I found even further warnings in the conffiles. I decided to also apply pep-8 space only indentation, because there were a few templates with tabs and spaces mixed and I wanted to get everything consistent. I hope that is also what you are after?
Comment 13 Florian Best univentionstaff 2020-05-06 12:42:26 CEST
That looks good except for the tabs → spaces changes. We have defined this in out Coding Style policy:
https://hutten.knut.univention.de/mediawiki/index.php/Code-Richtlinien#PEP8_Ausnahmen
Comment 14 Max Pohle univentionstaff 2020-06-24 11:15:17 CEST
fix: 8.0.0-8A~4.4.4.202006241111
Comment 15 Florian Best univentionstaff 2020-06-24 11:46:53 CEST
OK: still python2 compatible
OK: python 3 compatibility:
python3 /usr/sbin/ucr commit $(dpkg -L univention-base-files | grep templates/files  | sed 's#/etc/univention/templates/files##')
OK: YAML
Comment 16 Erik Damrose univentionstaff 2020-06-24 12:52:59 CEST
<http://errata.software-univention.de/ucs/4.4/631.html>