installer: index() raises ValueError

Expecting IndexError instead of ValueError led to traceback instead of correctly
reporting the error situation.

https://fedorahosted.org/freeipa/ticket/5945

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
David Kupka 2016-06-09 07:58:32 +02:00 committed by Martin Basti
parent 54318d1a2c
commit 9f48c39649

View File

@ -299,9 +299,9 @@ class ConfigureTool(admintool.AdminTool):
knob_cls = knob_classes[e.name]
try:
if self.positional_arguments is None:
raise IndexError
raise ValueError
index = self.positional_arguments.index(e.name)
except IndexError:
except ValueError:
cli_name = knob_cls.cli_name or e.name.replace('_', '-')
desc = "option --{0}".format(cli_name)
else: