Bug 39599 - UMC response without 'result' leads to KeyError exception
UMC response without 'result' leads to KeyError exception
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1
Assigned To: Florian Best
Daniel Tröder
: interim-2
Depends on:
  Show dependency treegraph
Reported: 2015-10-20 11:29 CEST by Daniel Tröder
Modified: 2015-12-15 11:02 CET (History)
2 users (show)

See Also:
What kind of report is it?: ---
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:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2015-10-20 11:29:09 CEST
A successful UMC call (eg to change a users password) can return no result, which leads to a KeyError when the request should be returned.

url = ""
data = {"password": {"password": oldpassword, "new_password": newpassword}}
  File "/usr/lib/pymodules/python2.7/univention/selfservice/frontend.py", line 109, in umc_request
    result = connection.request(url, data, command=command)
  File "/usr/lib/pymodules/python2.7/univention/lib/umc_connection.py", line 143, in request
    return loads(content)['result']
KeyError: 'result'


Index: base/univention-lib/python/umc_connection.py
--- base/univention-lib/python/umc_connection.py	(Revision 64615)
+++ base/univention-lib/python/umc_connection.py	(Arbeitskopie)
@@ -140,4 +140,4 @@
 				raise NotImplementedError('command forbidden: %s' % url)
 			raise HTTPException(error_message)
 		content = response.read()
-		return loads(content)['result']
+		return loads(content).get('result')
Comment 1 Florian Best univentionstaff 2015-10-20 19:26:02 CEST
Fixed, svn r64642
Comment 2 Daniel Tröder univentionstaff 2015-10-21 13:56:26 CEST
OK: Code review
OK: Manual functional test
OK: Changelog (64676) entry
Comment 3 Stefan Gohmann univentionstaff 2015-11-17 12:12:27 CET
UCS 4.1 has been released:

If this error occurs again, please use "Clone This Bug".