Bug 42619 - TypeError: int() argument must be a string or a number, not 'NoneType'
TypeError: int() argument must be a string or a number, not 'NoneType'
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - App-Center
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1-3-errata
Assigned To: Dirk Wiesenthal
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-10 18:01 CEST by Florian Best
Modified: 2016-11-09 17:31 CET (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.160
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2016101021000911, 2016101021000849
Bug group (optional): External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-10-10 18:01:27 CEST
Received a weird traceback:

Version: - errata0 ()

Traceback (most recent call last):
  File "%PY2.7%/univention/management/console/protocol/modserver.py", line 271, in handle
    self.__handler.init()
  File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 148, in init
    self.uu = UniventionUpdater(False)
  File "%PY2.7%/univention/updater/tools.py", line 579, in __init__
    self.ucr_reinit()
  File "%PY2.7%/univention/updater/tools.py", line 617, in ucr_reinit
    self.patchlevel = int(self.configRegistry['version/patchlevel'])
TypeError: int() argument must be a string or a number, not 'NoneType'
Comment 2 Florian Best univentionstaff 2016-10-10 18:18:22 CEST
There was a backup in /var/univention-backup/base.conf
Comment 3 Florian Best univentionstaff 2016-10-10 18:23:48 CEST
I could imagine the cause:
Bug #37402 occurred and made ucr.load() in a thread which resulted in a empty ucr dict.
The appcenter then sets some variables and does ucr.save() which overwrites the file with only those variables set.
Comment 4 Florian Best univentionstaff 2016-10-10 18:26:04 CEST
The following lines might be a misuse of UCR?
$ git grep ucr\\.save
python/appcenter-docker/actions/configure.py:                   _ucr.save()
umc/python/appcenter/util.py:   ucr.save()
Comment 5 Florian Best univentionstaff 2016-10-20 17:08:36 CEST
Please add this bug to the YAML file as you committed changes already.
Comment 6 Dirk Wiesenthal univentionstaff 2016-10-20 18:06:16 CEST
Removed ucr.save(), replaced handler_set with ucr_update, avoided two UCR instances in UMC App Center.

  univention-appcenter 5.0.22-22.228.201610201802

YAML added, merged to 4.2
Comment 7 Dirk Wiesenthal univentionstaff 2016-10-20 18:07:48 CEST
Could not reproduce the issue. But the patch should make it better in any case.

(In reply to Florian Best from comment #4)
> The following lines might be a misuse of UCR?
> $ git grep ucr\\.save
> python/appcenter-docker/actions/configure.py:                   _ucr.save()
> umc/python/appcenter/util.py:   ucr.save()

This has to be low level. This code writes /etc/univention/base.conf inside a container that has no UCR itself.
Comment 8 Philipp Hahn univentionstaff 2016-10-24 13:37:48 CEST
r73424 or some other commit broke Jenkins since 3 runs on all roles: <http://jenkins.knut.univention.de:8080/job/UCS-4.1/job/UCS-4.1-3/job/AutotestJoin/lastCompletedBuild/SambaVersion=s3,Systemrolle=slave/testReport/20_appcenter/20_can_apps_be_installed/test/>

>[2016-10-22 20:44:27.037135] [ APP: xrdp ]
>[2016-10-22 20:44:27.037145] broken packages: ['univention-xrdp']
>[2016-10-22 20:44:27.037153] output of apt-get install -s
>[2016-10-22 20:44:27.236939] File: /etc/apt/sources.list.d/20_ucs-online-component.list
>[2016-10-22 20:44:29.948209] File: /etc/apt/mirror.list
>[2016-10-22 20:44:30.057120] File: /etc/apt/sources.list.d/15_ucs-online-version.list
>[2016-10-22 20:44:37.141579] Executing the command: ['/usr/bin/apt-get', 'install', '-s', 'univention-xrdp']
>[2016-10-22 20:44:37.157305] Paketlisten werden gelesen...
>[2016-10-22 20:44:37.190308] Abhängigkeitsbaum wird aufgebaut....
>[2016-10-22 20:44:37.191378] Statusinformationen werden eingelesen....
>(2016-10-22 20:44:37.215175) E: Paket univention-xrdp kann nicht gefunden werden.
Comment 9 Dirk Wiesenthal univentionstaff 2016-10-25 22:36:45 CEST
I have adjusted the test case. The problem was a different UCR instance in the test than in the App Center
Comment 10 Florian Best univentionstaff 2016-10-26 00:00:14 CEST
Please merge the ucs-test changes to 4.1-4.

(In reply to Dirk Wiesenthal from comment #9)
> I have adjusted the test case. The problem was a different UCR instance in
> the test than in the App Center
I don't understand this. Please explain further why no two UCR instances may exists. This worked previously.
Comment 11 Dirk Wiesenthal univentionstaff 2016-10-26 02:05:30 CEST
Merged.

I thought it was two different UCR instances that interfere with each other.

After some debugging, I finally found out why the test failed:

with UCSTestConfigRegistry() as ucr:
  ...
  cm = ComponentManager(ucr, uu)

creates a ComponentManager that wants to add the component. But with the patch to umc-appcenter I do not do it with handler_set, but with ucr_update. And ucr_update uses:


def ucr_update(ucr, changes):
        with ucr:
                changed = ucr.update(changes)

And this __enter__ and __exit__ to a UCSTestConfigRegistry instance does revert changes before being able to commit it.

In summary, you cannot use UCSTestConfigRegistry together with ucr_update. That's why the test failed: No component could be registered in the test.
Comment 12 Florian Best univentionstaff 2016-10-26 13:16:50 CEST
OK, this sound valid. But the set UCR variables aren't reset anymore after executing the test. At least 'repository/app_center/server' is not reset if the test fails with some exception.
Comment 13 Dirk Wiesenthal univentionstaff 2016-10-27 01:27:51 CEST
(In reply to Florian Best from comment #12)
> OK, this sound valid. But the set UCR variables aren't reset anymore after
> executing the test. At least 'repository/app_center/server' is not reset if
> the test fails with some exception.

Actually, it should have been reset. I have clarified the test in
  ucs-test 6.0.36-38.1549.201610270052

I have also improved UCR handling in the App Center. The Docker Container configuration code had some lock/load issues. This was not the cause of this very bug as it only applies to certain Docker Containers, but it is related to this bug.
  univention-appcenter 5.0.22-23.229.201610261703
Comment 14 Florian Best univentionstaff 2016-10-31 14:55:48 CET
OK: The change improves UCR handling. I could not reproduce the error. My guess is still that it has to do with Bug #37402 (which is fixed in UCS 4.2).
OK: ucs-test adjustments
OK: UCS 4.2/4.1-4 merge
OK: YAML
Comment 15 Janek Walkenhorst univentionstaff 2016-11-03 11:32:43 CET
<http://errata.software-univention.de/ucs/4.1/322.html>