Bug 49422 - Shorten univention.debug
Shorten univention.debug
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-0-errata
Assigned To: Philipp Hahn
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-05-07 11:30 CEST by Philipp Hahn
Modified: 2019-06-26 17:42 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:
hahn: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2019-05-07 11:30:47 CEST
Most UDM code uses
 import univention.debug
...
 univention.debug.debug(univention.debug.CATEGORY, univention.debug.LEVEL, msg)
which creates very long lines, which are hard to read.

Convert that to
 import univention.debug as ud
...
 ud.debug(ud.CATEGORY, ud.LEVEL, msg)
which lots other code already does.

Patch-script:
 find -name debian -prune -o -type f -exec \
    sed -i -re 's/^(\s*import\s+univention.debug2?)(\s*(#.*)?)$/\1 as ud\2/;s/\<univention\.debug\./ud./g' {} +
Comment 1 Philipp Hahn univentionstaff 2019-05-07 11:34:11 CEST
git:phahn/49422-udm-debug
Comment 3 Philipp Hahn univentionstaff 2019-06-13 17:36:33 CEST
[4.4-0] 016e804f70 Bug #49422 udm: Shorten univention.debug usage
 .../univention-directory-manager-modules.yaml      |   7 +-
 .../debian/changelog                               |   6 +
 .../modules/univention/admin/__init__.py           |  28 +-
 .../modules/univention/admin/allocators.py         |  36 +--
 .../modules/univention/admin/handlers/__init__.py  | 284 ++++++++++-----------
 .../univention/admin/handlers/computers/__base.py  |   6 +-
 .../admin/handlers/computers/ipmanagedclient.py    |   2 +-
 .../admin/handlers/computers/trustaccount.py       |   2 +-
 .../univention/admin/handlers/container/ou.py      |   1 -
 .../modules/univention/admin/handlers/dhcp/host.py |   6 +-
 .../univention/admin/handlers/dhcp/subnet.py       |   2 +-
 .../univention/admin/handlers/dns/host_record.py   |   4 +-
 .../univention/admin/handlers/groups/group.py      |  40 +--
 .../univention/admin/handlers/nagios/service.py    |   2 +-
 .../univention/admin/handlers/networks/network.py  |   6 +-
 .../admin/handlers/policies/admin_container.py     |   2 +-
 .../admin/handlers/policies/autostart.py           |   2 +-
 .../univention/admin/handlers/policies/desktop.py  |   2 +-
 .../admin/handlers/policies/ldapserver.py          |   2 +-
 .../admin/handlers/policies/maintenance.py         |   4 +-
 .../admin/handlers/policies/masterpackages.py      |   2 +-
 .../admin/handlers/policies/memberpackages.py      |   2 +-
 .../admin/handlers/policies/nfsmounts.py           |   2 +-
 .../admin/handlers/policies/print_quota.py         |   2 +-
 .../admin/handlers/policies/printserver.py         |   2 +-
 .../admin/handlers/policies/pwhistory.py           |   2 +-
 .../univention/admin/handlers/policies/release.py  |   2 +-
 .../admin/handlers/policies/repositoryserver.py    |   2 +-
 .../admin/handlers/policies/repositorysync.py      |   4 +-
 .../admin/handlers/policies/share_userquota.py     |   2 +-
 .../admin/handlers/policies/slavepackages.py       |   2 +-
 .../univention/admin/handlers/policies/umc.py      |   2 +-
 .../admin/handlers/settings/extended_attribute.py  |   4 +-
 .../univention/admin/handlers/settings/license.py  |   2 +-
 .../univention/admin/handlers/settings/lock.py     |   2 +-
 .../univention/admin/handlers/settings/packages.py |   2 +-
 .../admin/handlers/settings/printermodel.py        |   2 +-
 .../admin/handlers/settings/printeruri.py          |   2 +-
 .../admin/handlers/settings/prohibited_username.py |   2 +-
 .../admin/handlers/settings/umc_operationset.py    |   2 +-
 .../univention/admin/handlers/shares/share.py      |   2 +-
 .../univention/admin/handlers/users/contact.py     |   2 +-
 .../univention/admin/handlers/users/passwd.py      |   2 +-
 .../univention/admin/handlers/users/user.py        |  46 ++--
 .../modules/univention/admin/hook.py               |  34 +--
 .../modules/univention/admin/license.py            |  28 +-
 .../modules/univention/admin/locking.py            |   8 +-
 .../modules/univention/admin/mapping.py            |  10 +-
 .../modules/univention/admin/modules.py            |   2 +-
 .../modules/univention/admin/nagios.py             |  16 +-
 .../modules/univention/admin/objects.py            |  24 +-
 .../modules/univention/admin/password.py           |   8 +-
 .../modules/univention/admin/syntax.py             |  20 +-
 .../modules/univention/admin/uldap.py              |  42 +--
 .../modules/univention/admincli/adduser.py         |  14 +-
 .../modules/univention/admincli/admin.py           |  20 +-
 .../modules/univention/admincli/license_check.py   |   2 +-
 .../modules/univention/admincli/passwd.py          |  36 +--
 .../modules/univention/udm/utils.py                |  28 +-
 .../scripts/check_group_recursion                  |  18 +-
 60 files changed, 428 insertions(+), 422 deletions(-)

Package: univention-directory-manager-modules
Version: 14.0.12-39A~4.4.0.201906131735
Branch: ucs_4.4-0
Scope: errata4.4-0

[4.4-0] be2ca40d6c Bug #49638: univention-directory-manager-modules 14.0.12-39A~4.4.0.201906131735
 doc/errata/staging/univention-directory-manager-modules.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 Florian Best univentionstaff 2019-06-13 17:42:59 CEST
There are a lot of unused univention.debug imports now.

settings/umc_operationset.py is broken now, because it only imported univention.debug but uses univention.admin.

I will commit a fix for you.
Comment 5 Florian Best univentionstaff 2019-06-13 17:55:07 CEST
univention-directory-manager-modules (14.0.12-40)
d0366e9d112e | Bug #49422: fixup shortening univention.debug usage
Comment 6 Florian Best univentionstaff 2019-06-13 18:24:36 CEST
Also fixed undefined name 'ud' [F821] in:

* ./scripts/check_group_recursion
* ./modules/univention/admin/nagios.py:273:23:
* ./modules/univention/admin/password.py:302:14:
* ./modules/univention/admin/handlers/nagios/service.py:253:15:
* ./modules/univention/admin/handlers/dns/host_record.py
* ./modules/univention/admin/handlers/users/contact.py:384:4:
* ./modules/univention/admin/handlers/computers/ipmanagedclient.py:239:13:
* ./modules/univention/admin/handlers/computers/__base.py:72:14:
* ./modules/univention/admin/handlers/computers/trustaccount.py:185:4:
* ./modules/univention/admin/handlers/policies/repositorysync.py:160:12:
Comment 7 Florian Best univentionstaff 2019-06-14 09:40:30 CEST
OK: shortening
OK: YAML
Comment 8 Arvid Requate univentionstaff 2019-06-26 17:42:54 CEST
<http://errata.software-univention.de/ucs/4.4/164.html>