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

Jan Cholasta jcholast at redhat.com
Thu Aug 6 12:35:29 UTC 2015


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

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list