extended provision-backend
Oliver Liebel
oliver at itc.li
Fri Aug 7 02:55:32 MDT 2009
Andrew Bartlett schrieb:
> On Fri, 2009-08-07 at 10:20 +0200, Oliver Liebel wrote:
>
>> Andrew Bartlett schrieb:
>>
>>> On Fri, 2009-08-07 at 10:16 +1000, Andrew Bartlett wrote:
>>>
>>>
>>>> On Fri, 2009-08-07 at 01:48 +0200, Oliver Liebel wrote:
>>>>
>>>>
>>>>>> Good, but don't go around killing processes until you have confirmed
>>>>>> that it's actually listening on the port. (The pid file could be left
>>>>>> around, and another process could have that pid)
>>>>>>
>>>>>> I would really prefer not to do the kill at all - perhaps just print out
>>>>>> what PID we think is still listening there. That is: do the ldap search
>>>>>> test first.
>>>>>>
>>>>>>
>>>>>>
>>>>> that should be fixed quick.
>>>>> first ldapsearch, then check if slapd-"provision"-pid == slapd.pid, then
>>>>> kill. ok.
>>>>>
>>>>>
>>>> I'm not sure how you intend to check the PID, but as I said, I would
>>>> prefer not to kill in the script, just print the PID.
>>>>
>>>>
>>> I've now read the patch more carefully. This seems like a great
>>> approach!
>>>
>>>
>> thanks. please tell me how you want to handle it:
>> just check the pid an print out, so the admin has to kill it self?
>> (e.g. "provision finished. slapd-provison-process with pid 12345 must
>> be terminated now. you should verify, that this is the correct pid
>> before you kill it.")
>> this would leave the responsibility to the admin.
>>
>
> I was unclear and confused: This is what I want:
>
> When we start a provision-backend, we look to see if a slapd is already
> listening on the ldapi socket, before we start a new slapd to listen
> there.
this operation is alread implemented, tested and verified(by
rootDSE-search) in the new patch.
> In this case we print the presumed PID of the old slapd that is
> in our way and abort.
>
hm.. how can we get this, as the process is not started by our
python-script?
i guess this would leave only ps -ef | grep | cut/awk or something...
> When we finish the provision, we shut down the slapd that we know we
> started. It's PID is recorded between provision-backend and provision,
> and verified with the slapd.pid.
ok, the new patch got alread both stored pids.
i only have to write some lines to verify pov-pid and slapd pid.
when both are identical, shut slapd down
> We also only do this if there is a
> working slapd on the socket.
>
this is also already monitored by the new patch (including rootDSE verify).
>
> Sure!
>
> provision.py has plenty of examples: To open the DB, see
> ldapi_url = "ldapi://%s" % urllib.quote(paths.s4_ldapi_path,
> safe="")
>
> ldapi_db = Ldb(ldapi_url)
>
> ldapi_db.search(base="", scope=SCOPE_BASE)
>
> Almost all the things on a 'samdb' in that script are actually ldb
> operations, wrapped by a slightly more helpful python class.
>
> If they succeed (I suspect you don't even need the search) then there is
> something on that socket, and we need to kill it (or abort, as
> required).
>
thank you very much!
i call on you if i got some more questions.
oliver
>
>> next point is the complete merge.
>> if we want to get all stuff into next alpha right on time,
>> i think it would be the best if you handle the merge,
>> because my time will be very limited the next weeks/months.
>>
>> thats also the point why i cant get deep enough into git.
>> hope thats no problem.
>>
>
> No worries!
>
> Andrew Bartlett
>
>
More information about the samba-technical
mailing list