Bug 23765 - Überschreiben des Attributes default von Properties
Überschreiben des Attributes default von Properties
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 2.4
Other Linux
: P5 normal (vote)
: UCS 3.2-1-errata
Assigned To: Dirk Wiesenthal
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-22 13:22 CEST by Andreas Büsching
Modified: 2014-04-22 11:05 CEST (History)
4 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:
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 Andreas Büsching univentionstaff 2011-09-22 13:22:11 CEST
Ich habe versucht den Default für description von users/user zu ändern:

ucr set directory/manager/web/modules/users/user/properties/description/default="<username>"

Das funktioniert leider nicht und wird beim Initialisieren des Modules mit dem folgenden Fehler quittiert (ich habe die Debugmeldung erweitert):

22.09.11 14:23:58.119  ADMIN       ( ERROR   ) : ucr_overwrite_properties: failed to set property attribute:   File "/usr/lib/pymodules/python2.6/univention/admin/__init__.py", line 81, in ucr_overwrite_properties
    setattr( module.property_descriptions[ prop ], attr, type( getattr( module.property_descriptions[ prop ], attr ) ) ( configRegistry[ var ] ) )

Im Modul users/user ist für description kein Default angegeben (wird dann im Objekt auf None gesetzt).
Comment 1 Andreas Büsching univentionstaff 2011-10-19 20:03:09 CEST
Das ist nur ein Sonderfall der schon länger problematisch ist -> 3.x
Comment 2 Stefan Gohmann univentionstaff 2014-03-25 15:53:54 CET
It should be possible to define a default mailHomeServer for example if the user was created via AD:

 directory/manager/web/modules/users/user/properties/mailHomeServer/default=master.test.local
Comment 3 Dirk Wiesenthal univentionstaff 2014-04-04 00:26:58 CEST
Fixed in
  univention-directory-manager-modules 9.0.75-20.1178.201404032359

YAML updated.

Problem was:
1. default is an instancemethod, the internal name of "default" is "base_default"
2. None caused a type cast error -> type(None)(new_value)
Comment 4 Florian Best univentionstaff 2014-04-07 10:56:23 CEST
The new code is the following:
 87 »   »   »   »   old_prop_val = getattr( prop, attr )
 88 »   »   »   »   if old_prop_val is None:
 89 »   »   »   »   »   # if the attribute was None the type cast
 90 »   »   »   »   »   #   will fail. best bet is str as type
 91 »   »   »   »   »   old_prop_val = ''
 92 »   »   »   »   prop_val_type = type( old_prop_val )
 94 »   »   »   »   if hasattr( prop, attr ):

getattr() in line 87 can here fail with an AttributeError. In line 94 you are using hasattr() which is then always true.
Comment 5 Dirk Wiesenthal univentionstaff 2014-04-07 11:36:25 CEST
Fixed in
  univention-directory-manager-modules 9.0.75-21.1179.201404071110
Comment 6 Florian Best univentionstaff 2014-04-11 11:52:20 CEST
OK, the overwrite works.

(The users/user description can not be overwritten somehow (neither in UMC nor on CLI), it is always the username-default used.)

YAML: OK
Comment 7 Moritz Muehlenhoff univentionstaff 2014-04-22 11:05:55 CEST
http://errata.univention.de/ucs/3.2/97.html