Bug 47913 - Provide UCR variables for setting log level in univention-updater
Provide UCR variables for setting log level in univention-updater
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Update - univention-updater
UNSTABLE
Other Linux
: P5 normal (vote)
: UCS 4.3-3-errata
Assigned To: Felix Botner
Arvid Requate
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-05 10:28 CEST by Moritz Bunkus
Modified: 2019-01-04 14:09 CET (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
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.023
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 Moritz Bunkus 2018-10-05 10:28:18 CEST
The updater code contains a lot of debug messages[1] that can never reach the updater.log as the `/usr/share/univention-updater/univention-updater` script only calls `ud.init(…)` but not `ud.set_level(…)`. It sure would be nice to be able to control the debug level via UCR variables like it's possible for other tools (e.g. the connectors) in order to debug problems. See this issue[2] for example.

[1] /usr/share/pyshared/univention/updater/tools.py
[2] https://help.univention.com/t/ucs-master-lauft-voll-und-kein-upgrade-moglich/9614/16
Comment 1 Julia Bremer univentionstaff 2018-12-13 17:05:14 CET
Successful build
Package: univention-updater
Version: 13.0.1-65A~4.3.0.201812131650
Branch: ucs_4.3-0
Scope: errata4.3-3


We are now able to set the debug level of univention-updater through
ucr set update/debug/level
Comment 2 Philipp Hahn univentionstaff 2018-12-14 13:36:09 CET
[4.3-3] 0a490b44c5 Bug #47913: univention-updater 13.0.1-65A~4.3.0.201812131650---
 doc/errata/staging/univention-updater.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/errata/staging/univention-updater.yaml b/doc/errata/staging/univention-updater.yaml
index 6ee0c5a2fa..7b5b62a4a9 100644
--- a/doc/errata/staging/univention-updater.yaml
+++ b/doc/errata/staging/univention-updater.yaml
@@ -5,6 +5,7 @@ scope: ucs_4.3-0-errata4.3-3
src: univention-updater
fix: 13.0.1-65A~4.3.0.201812131650
desc: |
 This update addresses the following [-issue(s):-]{+issue:+}
 * Added [-an UMC-Variable-]{+the UCR variable `update/debug/level`+} for changing the debug level of
   [-univention-updater-]{+the UCS updater.+}
bug: [47913]
Comment 3 Felix Botner univentionstaff 2018-12-17 11:51:28 CET
I get 

univention-upgrade --ignoressh --ignoreterm

Starting univention-upgrade. Current UCS version is 4.3-3 errata376

Checking for local repository:                          none
Checking for package updates:                           none
Checking for app updates:                               none
Checking for release updates:                           found: UCS 4.4-0
Do you want to update to 4.4-0 [Y|n]? Y

Starting update to UCS version 4.4-0

HINT:
Please check the release notes carefully BEFORE updating to UCS 4.4-0:
 English version: https://docs.software-univention.de/release-notes-4.4-0-en.html
 German version:  https://docs.software-univention.de/release-notes-4.4-0-de.html

Please also consider documents of following release updates and
3rd party components.

Do you want to continue [Y/n]? Y

Checking for space on /var/cache/apt/archives: OK
Checking for space on /boot: OK
Checking for space on /: OK
Checking for package status: OK
Checking LDAP schema: OK

Starting update process, this may take a while.
Check /var/log/univention/updater.log for more information.
Running postup.sh script:done.
Traceback (most recent call last):
  File "/usr/share/univention-updater/univention-updater", line 610, in <module>
    main()
  File "/usr/share/univention-updater/univention-updater", line 351, in main
    ud.set_level(ud.NETWORK, loglevel)
TypeError: an integer is required
ERROR: update failed. Please check /var/log/univention/updater.log


during the update.

loglevel should be int!
Comment 4 Julia Bremer univentionstaff 2018-12-17 13:21:27 CET
dbdff0b288 Bug #47913: Advisory
5af8952a6f Bug #47913: Code cleanup and version bump

Successful build
Package: univention-updater
Version: 13.0.1-66A~4.3.0.201812170955
Branch: ucs_4.3-0
Scope: errata4.3-3
User: jbremer

fixed
Comment 5 Philipp Hahn univentionstaff 2018-12-18 11:49:34 CET
git:157cbc6e610db48847894c88d37b32c08e8a7c24 breaks every Updater test:
>(2018-12-18 00:51:02.145090) Traceback (most recent call last):
>(2018-12-18 00:51:02.145150)   File "/usr/share/univention-updater/univention-updater", line 610, in <module>
>(2018-12-18 00:51:02.145221)     main()
>(2018-12-18 00:51:02.145245)   File "/usr/share/univention-updater/univention-updater", line 388, in main
>(2018-12-18 00:51:02.145264)     baseConfig = ucr.ConfigRegistry()
>(2018-12-18 00:51:02.145315) AttributeError: 'ConfigRegistry' object has no attribute 'ConfigRegistry'

From python/univention-updater
> 48 from univention.config_registry import ConfigRegistry
...
> 55 import univention.config_registry as ucr
...
> 79 ucr = ConfigRegistry()
Comment 6 Philipp Hahn univentionstaff 2018-12-18 11:54:08 CET
(In reply to Philipp Hahn from comment #5)
> git:157cbc6e610db48847894c88d37b32c08e8a7c24 breaks every Updater test:
> >(2018-12-18 00:51:02.145090) Traceback (most recent call last):
> >(2018-12-18 00:51:02.145150)   File "/usr/share/univention-updater/univention-updater", line 610, in <module>
> >(2018-12-18 00:51:02.145221)     main()
> >(2018-12-18 00:51:02.145245)   File "/usr/share/univention-updater/univention-updater", line 388, in main
> >(2018-12-18 00:51:02.145264)     baseConfig = ucr.ConfigRegistry()
> >(2018-12-18 00:51:02.145315) AttributeError: 'ConfigRegistry' object has no attribute 'ConfigRegistry'
> 
> From python/univention-updater
> > 48 from univention.config_registry import ConfigRegistry
> ...
> > 55 import univention.config_registry as ucr
> ...
> > 79 ucr = ConfigRegistry()
...
> 388     baseConfig = ucr.ConfigRegistry(

Move that last line before line 250, remove line 55 and use `baseConfig` in 350:

> - 350     loglevel = ucr.get('update/debug/level', 2)
> + 350     loglevel = baseConf.get('update/debug/level', 2)

If you want to clean up the code rename the "baseConf" to "ucr" to get rid of that historic name.

PS: Have a look at "flake8" and/or "mypy" which would flag line 79 as
> redefinition of unused 'ucr' from line 55 [F811] [python/flake8]
Comment 7 Arvid Requate univentionstaff 2018-12-18 20:23:51 CET
Ok, you Felix fixed it in 4.3-3 and I fixed it in 4.4-0 and then Felix improved my fix.
Comment 8 Arvid Requate univentionstaff 2018-12-19 13:51:05 CET
<http://errata.software-univention.de/ucs/4.3/387.html>