[Freeipa-devel] [PATCH 0053] fix crash when installer with no positional arguments handles invalid options

Martin Babinsky mbabinsk at redhat.com
Thu Aug 6 12:48:15 UTC 2015


On 08/06/2015 02:35 PM, Jan Cholasta wrote:
> Hi,
>
> Dne 6.8.2015 v 14:29 Martin Babinsky napsal(a):
>> This bug was discovered when writing tests for functionality introduced
>> in my PATCH 0051.
>>
>> This patch should apply on top of PATCH 0051.
>
> This whole patch can be reduced to:
>
>           except core.KnobValueError as e:
>               knob_cls = getattr(transformed_cls, e.name)
>               try:
> -                index = self.positional_arguments.index(e.name)
> -            except IndexError:
> +                if self.positional_arguments:
> +                    index = self.positional_arguments.index(e.name)
> +                else:
> +                    raise ValueError
> +            except ValueError:
>                   cli_name = knob_cls.cli_name or e.name.replace('_', '-')
>                   desc = "option --{0}".format(cli_name)
>               else:
>
> Honza
>
Right. I have rewritten the patch in your way.

-- 
Martin^3 Babinsky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mbabinsk-0053.1-fix-crash-when-installer-with-no-positional-argument.patch
Type: text/x-patch
Size: 1384 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20150806/8d568a13/attachment.bin>


More information about the Freeipa-devel mailing list