summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-01-18 14:22:43 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-19 17:24:47 +0000
commitd2090a6ba1439c4fe8baf6a35316964ba4ffe39f (patch)
tree408ae41d4ab18fd5119aeb6d3a16c7e075457253 /scripts/lib/wic
parent1ed97cc886832047945c18e13ea098c775c7f2cc (diff)
downloadpoky-d2090a6ba1439c4fe8baf6a35316964ba4ffe39f.tar.gz
wic: improve processing of parseing errors
Caught argparse.ArgumentError Included .ks file name and line number into the error messages. (From OE-Core rev: 549c76ebda9afba0771d6d2c9b0b83f7a479c626) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/kickstart.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/lib/wic/kickstart.py b/scripts/lib/wic/kickstart.py
index 7f0105dd07..5d3a572a77 100644
--- a/scripts/lib/wic/kickstart.py
+++ b/scripts/lib/wic/kickstart.py
@@ -27,7 +27,7 @@
27 27
28 28
29import shlex 29import shlex
30from argparse import ArgumentParser, ArgumentTypeError 30from argparse import ArgumentParser, ArgumentError, ArgumentTypeError
31 31
32from wic.partition import Partition 32from wic.partition import Partition
33 33
@@ -113,11 +113,16 @@ class KickStart(object):
113 line = line.strip() 113 line = line.strip()
114 lineno += 1 114 lineno += 1
115 if line and line[0] != '#': 115 if line and line[0] != '#':
116 parsed = parser.parse_args(shlex.split(line)) 116 try:
117 parsed = parser.parse_args(shlex.split(line))
118 except ArgumentError as err:
119 raise KickStartError('%s:%d: %s' % \
120 (confpath, lineno, err))
117 if line.startswith('part'): 121 if line.startswith('part'):
118 self.partitions.append(Partition(parsed, lineno)) 122 self.partitions.append(Partition(parsed, lineno))
119 else: 123 else:
120 if not self.bootloader: 124 if not self.bootloader:
121 self.bootloader = parsed 125 self.bootloader = parsed
122 else: 126 else:
123 raise KickStartError("Error: more than one bootloader specified") 127 raise KickStartError("%s:%d: more than one bootloader "\
128 "specified" % (confpath, lineno))