[PATCH] Merged provision and provision-backend

Michael Ströder michael at stroeder.com
Mon Aug 17 07:59:24 MDT 2009


Andrew Bartlett wrote:
> On Fri, 2009-08-14 at 16:21 +0200, Oliver Liebel wrote:
>> Andrew Bartlett schrieb:
>>> On Thu, 2009-08-13 at 17:39 +1000, Andrew Bartlett wrote:
>>>   
>>>> On Thu, 2009-08-13 at 17:07 +1000, Andrew Bartlett wrote:
>>>>     
>>>>> Attached is a great slab of work, aimed at merging the provision and
>>>>> provision-backend scripts.  I've taken quite a comprehensive approach to
>>>>> the problem, and have also looked into some of the performance issues in
>>>>> the 'normal' provision. 
>>>>>
>>>>> Attached is the patch series. 
>>>>>
>>>>> Let me know how it goes, as I can't actually get OpenLDAP to start.
>>>>> I've CC'ed Howard for some assistance on that point :-)
>>>>>       
>>>> Rather than waste more bandwidth with another patch set, I've pushed a
>>>> rebased set (on top of current master) to 
>>>>
>>>> git://git.samba.org/abartlet/samba.org openldap-backend
>>>>     
>>> After a long night of fixes (I've updated the branch again), I've almost
>>> got everything working in this branch, at least as far as I can tell
>>> with my busted OpenLDAP setup.
>>>
>>> Can you give this a test, and let me know?
>>>
>>> Thanks,
>>>
>>>   
>> tested on oss 11.1 64bit:
>>
>> 1.) "normal" provision:
>> we ran into this error, but it seems to be more "cosmetic":
>>
>> #> setup/provision --realm=ldap.local.site --domain=LDAP 
>> --adminpass=linux --server-role="domain controller" 
>> --slapd-path="/usr/local/libexec/slapd" --ldap-backend-type=openldap 
>> --ldap-backend-extra-port=9000
>>
>> -----------
>> ...
>> hdb_db_open: database 
>> "cn=Schema,cn=Configuration,dc=ldap,dc=local,dc=site": 
>> db_open(/usr/local/s4-ol/private/ldap/db/schema/id2entry.bdb) failed: No 
>> such file or directory (2).
>> backend_startup_one: bi_db_open failed! (2)
>> slap_startup failed (test would succeed using the -u switch)
>> Failed to bind - LDAP client internal error: 
>> NT_STATUS_UNEXPECTED_NETWORK_ERROR
>> Failed to connect to 
>> 'ldapi://%2Fusr%2Flocal%2Fs4-ol%2Fprivate%2Fldap%2Fldapi'
> 
> Yeah, I'll need to work to prevent the lower layers here from emiting
> the expected error messages.  This might take time. 
> 
>> Setting up share.ldb
>> Setting up secrets.ldb
>> ...
>> <rest ok>
>> ...
>> -------------
>>
>> post-provision: start slapd,  fire up s4: everythings ok,
>> and the good news:
>> no crash any more when connecting with ldap-client (ldbsearch, 
>> ldapsearch, apache DS)
>>
>> theres a small error, when detecting if another instance of slapd is 
>> already listening on our
>> ldapi_uri:
>>
>> ------------
>> ...
>> Check for slapd Process with PID: 1888
>>  and terminate it manually.
>> Traceback (most recent call last):
>>   File "setup/provision", line 198, in <module>
>>     ldap_dryrun_mode=opts.ldap_dryrun_mode)
>>   File "bin/python/samba/provision.py", line 1076, in provision
>>     ldap_dryrun_mode=ldap_dryrun_mode)
>>   File "bin/python/samba/provision.py", line 1317, in __init__
>>     raise("Warning: Another slapd Instance seems already running on this 
>> host, listening to " + ldapi_uri + ". Please shut it down before you 
>> continue. ")
>> NameError: global name 'ldapi_uri' is not defined
>> ...
>> --------------
> 
> Fixed. 
> 
>> Changing the line (1317):
>>
>> raise ("Warning: Another slapd Instance seems already running on this 
>> host, listening to " + ldapi_uri + ". Please shut it down before you 
>> continue. ")
>>
>> to:
>>
>>  raise(self.ldapi_uri)
>>
>> gave me this error:
>>
>> TypeError: exceptions must be classes or instances, not str
> 
> Yeah, I need to look into the correct way to raise exceptions.  I think
> I need to have a particular exception object I return. 

How about this one:

>>> import socket
>>> raise socket.error,"Another slapd Instance seems already running on this
host listening to %s" % (ldapi_uri)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: Another slapd Instance seems already running on this host

You can see that socket.error gets initialized with a simple string. The
cleanest solution would be to define your own exception classes with detailed
argument list in __init__() but that is likely overkill for this simple case.

Ciao, Michael.


More information about the samba-technical mailing list