Bug 41185 - Traceback in google-apps-user.py when setting a sync value to 'empty'
Summary: Traceback in google-apps-user.py when setting a sync value to 'empty'
Status: CLOSED FIXED
Alias: None
Product: UCS
Classification: Unclassified
Component: Google Apps for Work
Version: UCS 4.1
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: Daniel Tröder
QA Contact: Erik Damrose
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-02 13:53 CEST by Erik Damrose
Modified: 2016-09-29 21:10 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2016-05-02 13:53:09 CEST
When e.g. removing the firstname of a user who is activated for google apps for work, the listener will fail with the following traceback:

02.05.16 13:43:21.595  LISTENER    ( PROCESS ) : gafw: Modified google account of user 'univention2'.
Traceback (most recent call last):
  File "/usr/lib/univention-directory-listener/system/google-apps-user.py", line 322, in handler
    ol.modify_google_user(old, new)
  File "/usr/lib/pymodules/python2.7/univention/googleapps/listener.py", line 154, in modify_google_user
    ["{} ({}): {}".format(mod, ",".join(self.attrs["google_attribs"][mod]), new[mod]) for mod in modifications])
KeyError: 'givenName'
Comment 1 Daniel Tröder univentionstaff 2016-05-02 15:17:16 CEST
fixed in r69055
Comment 2 Erik Damrose univentionstaff 2016-05-02 17:33:43 CEST
Reopen: The traceback is gone, but the value is not modified in the google cloud. I think it should be set to empty or to a random string, whichever is the default for the given value
Comment 3 Erik Damrose univentionstaff 2016-05-02 17:36:44 CEST
No blocker for Bug 37949
Comment 4 Daniel Tröder univentionstaff 2016-05-03 09:09:15 CEST
(In reply to Erik Damrose from comment #2)
> Reopen: The traceback is gone, but the value is not modified in the google
> cloud.
That's bad luck with the test. Deleting other properties works.
familyName and givenName are mandatory attributes for Google and are being *restored* after removal by them. Try this:

from univention.googleapps.handler import GappsHandler
gh = GappsHandler(None)
test02 = '100862214349746867174'
gh.modify_user(test02, {"name": {"givenName": None}})

It will return the user resource:
{..
u'name': {u'familyName': u'test02ln', u'fullName': u'abcdef test02ln'},
..}

Now run:
gh.get_user(test02)

It will return:
{..
u'name': {u'familyName': u'test02ln', u'fullName': u'abcdef test02ln', u'givenName': u'abcdef'},
..}

Google has restored (or blocked) the deleted givenName.

> I think it should be set to empty or to a random string, whichever is
> the default for the given value
I don't want to do that generally. That would mean that multiple-value properties (_all_ properties except name) cannot be deleted anymore.

It would be possible however to give name:{familyName, givenName} a special treatment...

... done in r69062.
Comment 5 Erik Damrose univentionstaff 2016-05-31 11:21:54 CEST
Verified with latest app release, i just forgot to close this bug