diff options
Diffstat (limited to 'scripts/lib/wic/kickstart.py')
| -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 | |||
| 34 | class KickStartError(Exception): | 34 | class KickStartError(Exception): |
| 35 | pass | 35 | pass |
| 36 | 36 | ||
| 37 | class KickStartParser(ArgumentParser): | ||
| 38 | """ | ||
| 39 | This class overwrites error method to throw exception | ||
| 40 | instead of producing usage message(default argparse behavior). | ||
| 41 | """ | ||
| 42 | def error(self, message): | ||
| 43 | raise ArgumentError(None, message) | ||
| 44 | |||
| 37 | def sizetype(arg): | 45 | def sizetype(arg): |
| 38 | """ | 46 | """ |
| 39 | Custom type for ArgumentParser | 47 | Custom type for ArgumentParser |
| @@ -77,7 +85,7 @@ class KickStart(object): | |||
| 77 | self.bootloader = None | 85 | self.bootloader = None |
| 78 | self.lineno = 0 | 86 | self.lineno = 0 |
| 79 | 87 | ||
| 80 | parser = ArgumentParser() | 88 | parser = KickStartParser() |
| 81 | subparsers = parser.add_subparsers() | 89 | subparsers = parser.add_subparsers() |
| 82 | 90 | ||
| 83 | part = subparsers.add_parser('part') | 91 | part = subparsers.add_parser('part') |
