Univention Bugzilla – Bug 51006
Migrate templates from univention-base to Python3 and keep them Python2 compatible
Last modified: 2020-06-24 12:52:59 CEST
The templates should be migrated in such a way, that they remain backward compatible with python2.
QA took place on a branch Now merged to the current master 4.4-4
Can you make your scripts/plugins somewhere publicy available?
Changes are OK, package has not been built, and no yaml has been created.
Package was build and yaml release file now exists.
Changes: OK Package built: OK yaml: OK I changed the description in the advisory a bit. 8600a6bc36 Bug #51006: Adjust yaml Verified
@Florian: The Vim plugin was made internally available. It can be tested quality approved and possibly published after that. Search for 'vim-ucr-template'.
base/univention-base-files/conffiles/etc/rsyslog.conf: print() in python 2 this print() causes the output: >>> print() ()
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
Fixed print() in cb3a264541773737966392707b9bc76a2dc48910 fix: 8.0.0-7A~4.4.4.202005041029
Changes: OK Yaml: OK Package install: OK Verified
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
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?
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
fix: 8.0.0-8A~4.4.4.202006241111
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
<http://errata.software-univention.de/ucs/4.4/631.html>