[Freeipa-devel] [PATCH 0224] cainstance: Read CS.cfg for preop.pin in a loop
Martin Kosek
mkosek at redhat.com
Thu Jun 12 08:45:17 UTC 2014
On 06/11/2014 06:49 PM, Nathaniel McCallum wrote:
> On Wed, 2014-06-11 at 11:08 +0200, Tomas Babej wrote:
>> Hi,
>>
>> As due to possible race conditions, the preop.pin might not be
>> written in the CS.cfg at the time installer tries to read it.
>>
>> In case no value for preop.pin was found, retry until timeout
>> was reached.
>>
>> https://fedorahosted.org/freeipa/ticket/3382
>>
>> (applies on ipa-3-0 branch)
>
> There is inconsistent spacing around '='. For instance:
> + f=open(filename, 'r')
> + data = f.read()
>
> Also, I'm fairly certain this is incorrect:
> + total_timeout =+ 1
>
> Nathaniel
+1, this is certainly is not a deterministic, constant measuring of a timeout.
I would rather see something like
op_timeout = time.time() + api.env.startup_timeout
while preop_pin is None and time.time() < op_timeout:
Also, I do not think this will work, IOError is risen when a file is not found,
so this code would not solve the problem if waiting on file to appear.
Martin
More information about the Freeipa-devel
mailing list