diff options
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/kickstart.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/lib/wic/kickstart.py b/scripts/lib/wic/kickstart.py index 5d3a572a77..7dbe052714 100644 --- a/scripts/lib/wic/kickstart.py +++ b/scripts/lib/wic/kickstart.py @@ -34,6 +34,14 @@ from wic.partition import Partition class KickStartError(Exception): pass +class KickStartParser(ArgumentParser): + """ + This class overwrites error method to throw exception + instead of producing usage message(default argparse behavior). + """ + def error(self, message): + raise ArgumentError(None, message) + def sizetype(arg): """ Custom type for ArgumentParser @@ -77,7 +85,7 @@ class KickStart(object): self.bootloader = None self.lineno = 0 - parser = ArgumentParser() + parser = KickStartParser() subparsers = parser.add_subparsers() part = subparsers.add_parser('part') |