#2520 ldap updater exeptions on add not helpful
Closed: Fixed None Opened 12 years ago by rcritten.

The variable entry does not handle str() or repr() properly and returns None which is causing exception handling to blow up.

This demonstrates it very well.

dn: uid=adtrust,cn=sysaccounts,cn=etc,$SUFFIX
add: objectClass: account
add: objectClass: simplesecurityobject
add: uid: adtrust



2012-03-12T20:55:03Z INFO New entry: uid=adtrust,cn=sysaccounts,cn=etc,dc=ipa,dc=local
2012-03-12T20:55:03Z DEBUG ---------------------------------------------
2012-03-12T20:55:03Z DEBUG dn: uid=adtrust,cn=sysaccounts,cn=etc,dc=ipa,dc=local
2012-03-12T20:55:03Z DEBUG add: 'account' to objectClass, current value []
2012-03-12T20:55:03Z DEBUG add: updated value [u'account']
2012-03-12T20:55:03Z DEBUG ---------------------------------------------
2012-03-12T20:55:03Z DEBUG dn: uid=adtrust,cn=sysaccounts,cn=etc,dc=ipa,dc=local
2012-03-12T20:55:03Z DEBUG objectClass: 
2012-03-12T20:55:03Z DEBUG      account
2012-03-12T20:55:03Z DEBUG add: 'simplesecurityobject' to objectClass, current value ['account']
2012-03-12T20:55:03Z DEBUG add: updated value ['account', u'simplesecurityobject']
2012-03-12T20:55:03Z DEBUG ---------------------------------------------
2012-03-12T20:55:03Z DEBUG dn: uid=adtrust,cn=sysaccounts,cn=etc,dc=ipa,dc=local
2012-03-12T20:55:03Z DEBUG objectClass: 
2012-03-12T20:55:03Z DEBUG      account
2012-03-12T20:55:03Z DEBUG      simplesecurityobject
2012-03-12T20:55:03Z DEBUG add: 'adtrust' to uid, current value []
2012-03-12T20:55:03Z DEBUG add: updated value [u'adtrust']
2012-03-12T20:55:03Z DEBUG ---------------------------------------------
2012-03-12T20:55:03Z DEBUG dn: uid=adtrust,cn=sysaccounts,cn=etc,dc=ipa,dc=local
2012-03-12T20:55:03Z DEBUG objectClass: 
2012-03-12T20:55:03Z DEBUG      account
2012-03-12T20:55:03Z DEBUG      simplesecurityobject
2012-03-12T20:55:03Z DEBUG uid: 
2012-03-12T20:55:03Z DEBUG      adtrust
2012-03-12T20:55:03Z DEBUG ---------------------------------------------
2012-03-12T20:55:03Z DEBUG Final value
2012-03-12T20:55:03Z DEBUG dn: uid=adtrust,cn=sysaccounts,cn=etc,dc=ipa,dc=local
2012-03-12T20:55:03Z DEBUG objectClass: 
2012-03-12T20:55:03Z DEBUG      account
2012-03-12T20:55:03Z DEBUG      simplesecurityobject
2012-03-12T20:55:03Z DEBUG uid: 
2012-03-12T20:55:03Z DEBUG      adtrust
2012-03-12T20:55:03Z ERROR Add failure 'NoneType' object is not callable

The error is in ipaldap.py in addEntry():

        try:
            if sctrl is not None:
                self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl)
            self.add_s(entry.dn, entry.toTupleList())
        except ldap.LDAPError, e:
            arg_desc = 'entry=%s' % (entry)
            self.__handle_errors(e, arg_desc=arg_desc)
        return True

We eihter need to use entry.toTupleList() or make str/repr do something useful.


I will fix that along with #2743.

Metadata Update from @rcritten:
- Issue assigned to mkosek
- Issue set to the milestone: FreeIPA 3.0 Core Effort - 2012/05

7 years ago

Login to comment on this ticket.

Metadata