On 01/12/2015 05:45 PM, Martin Babinsky wrote: > related to ticket https://fedorahosted.org/freeipa/ticket/4808 > > Patch attached. > > Martin^3
I think the --tgt-kinit-attempts approach is good one. Couple comments I have when reading the patch: 1) Function +def get_host_tgt(options, keytab, host, realm, env): should be made more general purpose and instead of whole "options", it should rather accept just "kinit_attemps". It will then enable future generations to reuse the function for something else. Just a generally good practice, nothing critical. 2) I think + if returncode == 0: + root_logger.info("Attempt %d succeeded." % n_attempts) + break can be just DEBUG level. People do not need to know we will try multiple attempts. 3) It may be even better to print "Attempt %d/%d failed." instead of just number. But this is up to you. 4) I see several C-isms in the code, as a programming practice, let us remove them :-) In Python, the OK/notOK status is generally passed via exceptions, not return codes unless you really need them for anything meaningful. So, you can omit "raiseonerr=False" and have the handling code in an Except clause. When max number of attempts is breached, you then just raise the exception further (use bare "raise", to re-raise to keep the original stack). Martin _______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel