From: Michael E. <men...@ka...> - 2003-05-14 17:56:29
|
Hi Is it possible to add an ou to a directory using python-ldap I'm trying to add something like this to my directory (this LDIF works with ldapadd fine) dn: ou=Sales,o=somecompany.com objectclass: top objectclass: organizationalunit ou: Sales When i tried doing this using the add(dn, modlist) function, it failed with an error saying the "dn: attribute type undefined" Any tips would be appreciated. THanks Michael |
From: <mi...@st...> - 2003-05-14 18:06:45
|
Michael Engelhart wrote: > > When i tried doing this using the add(dn, modlist) function, it failed > with an error saying the "dn: attribute type undefined" Are you sure that your entry data in the modlist contains the attribute used for RDN? Please post the code. Ciao, Michael. |
From: Michael E. <men...@ka...> - 2003-05-14 18:20:49
|
No, I'm not sure. :-) I guess my misunderstanding is that add() requests a dn. What dn do=20 you enter for a top-level or mid-level organizationalUnit? If have the following single entry setup in my OpenLDAP directory: dn: o=3Dmycompany.com objectclass: top objectclass: organization o: mycompany.com and then want to add from python-ldap this organizationUnit: dn: ou=3DPeople,o=3Dmycompany.com objectclass: top objectclass: organizationalunit ou: People try: bind_dn=3D"cn=3DDirectory Manager,o=3Dmycompany.com" password =3D "xxxxxxxxx" l =3D LDAPWrapper(bind_dn,password) dnToAddTo =3D "o=3Dmycompany.com" modlist =3D [] modlist.append(('dn','ou=3DPeople,o=3Dmycompany.com')) modlist.append(('objectclass',['top','organizationalunit'])) modlist.append(('ou','People')) l.add(dnToAddTo, modlist) l.close() except ldap.LDAPError, e: print e I get this error: {'info': 'dn: attribute type undefined', 'desc': 'Undefined attribute=20 type'} Thanks Michael On Wednesday, May 14, 2003, at 02:06 PM, Michael Str=F6der wrote: > Are you sure that your entry data in the modlist contains the=20 > attribute used for RDN? > > Please post the code. > > Ciao, Michael. |
From: Michael E. <men...@ka...> - 2003-05-14 18:55:46
|
BTW, the LDAPWrapper is just simple wrapper class that I wrote. The add method looks like this: def add(self, dn, modlist): # synchronous add try: self.server.add_s(dn, modlist) except ldap.LDAPError, e: raise On Wednesday, May 14, 2003, at 02:20 PM, Michael Engelhart wrote: > No, I'm not sure. :-) > I guess my misunderstanding is that add() requests a dn. What dn do=20= > you enter for a top-level or mid-level organizationalUnit? > > If have the following single entry setup in my OpenLDAP directory: > > dn: o=3Dmycompany.com > objectclass: top > objectclass: organization > o: mycompany.com > > > and then want to add from python-ldap this organizationUnit: > > dn: ou=3DPeople,o=3Dmycompany.com > objectclass: top > objectclass: organizationalunit > ou: People > > > try: > bind_dn=3D"cn=3DDirectory Manager,o=3Dmycompany.com" > password =3D "xxxxxxxxx" > l =3D LDAPWrapper(bind_dn,password) > dnToAddTo =3D "o=3Dmycompany.com" > modlist =3D [] > modlist.append(('dn','ou=3DPeople,o=3Dmycompany.com')) > modlist.append(('objectclass',['top','organizationalunit'])) > modlist.append(('ou','People')) > l.add(dnToAddTo, modlist) > l.close() > except ldap.LDAPError, e: > print e > > I get this error: > {'info': 'dn: attribute type undefined', 'desc': 'Undefined attribute=20= > type'} > > Thanks > Michael > > On Wednesday, May 14, 2003, at 02:06 PM, Michael Str=F6der wrote: > >> Are you sure that your entry data in the modlist contains the=20 >> attribute used for RDN? >> >> Please post the code. >> >> Ciao, Michael. > |
From: <mi...@st...> - 2003-05-15 06:51:23
|
Michael Engelhart wrote: > BTW, the LDAPWrapper is just simple wrapper class that I wrote. > > The add method looks like this: > def add(self, dn, modlist): > # synchronous add > try: > self.server.add_s(dn, modlist) > except ldap.LDAPError, e: > raise And what's the rationale for that? Well, it's up to you... Ciao, Michael. |
From: Michael E. <men...@ka...> - 2003-05-15 13:48:55
|
To encapsulate the application specific ldap functionality into a=20 single class as well as wrapping the basic add, modify, search, and=20 delete functionality. Obviously the add, modify and delete methods don't do anything really=20 more than what calling ldap directly does. Just makes my code tidier and easier to manage. On Thursday, May 15, 2003, at 02:51 AM, Michael Str=F6der wrote: > Michael Engelhart wrote: > > BTW, the LDAPWrapper is just simple wrapper class that I wrote. > > > > The add method looks like this: > > def add(self, dn, modlist): > > # synchronous add > > try: > > self.server.add_s(dn, modlist) > > except ldap.LDAPError, e: > > raise > > And what's the rationale for that? Well, it's up to you... > > Ciao, Michael. > > > > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux enterprise=20 > solutions > www.enterpriselinuxforum.com > > _______________________________________________ > Python-LDAP-dev mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev > |
From: <mi...@st...> - 2003-05-15 06:51:24
|
Michael Engelhart wrote: > I guess my misunderstanding is that add() requests a dn. The dn is the complete DN of the new entry => you have to form a new RDN and concatenate this with a base DN of an existing entry. > modlist.append(('dn','ou=People,o=mycompany.com')) Not needed and probably not allowed. > l.add(dnToAddTo, modlist) l.add('ou=People,o=mycompany.com', modlist) > I get this error: > {'info': 'dn: attribute type undefined', 'desc': 'Undefined attribute > type'} Now it's clearer: The attribute type 'dn' is not existent in schema (and not needed as already stated above). Ciao, Michael. |
From: Michael E. <men...@ka...> - 2003-05-15 13:44:46
|
Thanks. So there's no way to dynamically create organzitaionalUnits=20 into an existing schema using python-ldap. I have to manually add a dn before I can add entries to it. Is that=20 correct? Thanks MIke On Thursday, May 15, 2003, at 02:49 AM, Michael Str=F6der wrote: > Michael Engelhart wrote: > > I guess my misunderstanding is that add() requests a dn. > > The dn is the complete DN of the new entry > =3D> you have to form a new RDN and concatenate this with a base DN of=20= > an existing entry. > > > modlist.append(('dn','ou=3DPeople,o=3Dmycompany.com')) > > Not needed and probably not allowed. > > > l.add(dnToAddTo, modlist) > > l.add('ou=3DPeople,o=3Dmycompany.com', modlist) > > > I get this error: > > {'info': 'dn: attribute type undefined', 'desc': 'Undefined = attribute > > type'} > > Now it's clearer: The attribute type 'dn' is not existent in schema=20 > (and not needed as already stated above). > > Ciao, Michael. > > > > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux enterprise=20 > solutions > www.enterpriselinuxforum.com > > _______________________________________________ > Python-LDAP-dev mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev > |
From: <mi...@st...> - 2003-05-15 15:00:18
|
Michael Engelhart wrote: > So there's no way to dynamically create organzitaionalUnits > into an existing schema using python-ldap. Off course you can dynamically create entries of object class organizationalUnit. > I have to manually add a dn before I can add entries to it. Is that > correct? Please make sure to fully understand the LDAP data model before start coding: entries, attributes, naming, schema, etc. A good book might be of great help. Ciao, Michael. |
From: Tjabo K. <t.k...@bi...> - 2003-05-21 07:24:07
|
Am Donnerstag, 15. Mai 2003 15:44 schrieb Michael Engelhart: > Thanks. So there's no way to dynamically create organzitaionalUnits > into an existing schema using python-ldap. what? I don't believe this. Have been on vacancy for some days. gonna have a look at it... |