summaryrefslogtreecommitdiffstats
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
parent1ed97cc886832047945c18e13ea098c775c7f2cc (diff)
downloadopenembedded-core-contrib-d2090a6ba1439c4fe8baf6a35316964ba4ffe39f.tar.gz
openembedded-core-contrib-d2090a6ba1439c4fe8baf6a35316964ba4ffe39f.tar.bz2
openembedded-core-contrib-d2090a6ba1439c4fe8baf6a35316964ba4ffe39f.zip
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>
-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 @@
import shlex
-from argparse import ArgumentParser, ArgumentTypeError
+from argparse import ArgumentParser, ArgumentError, ArgumentTypeError
from wic.partition import Partition
@@ -113,11 +113,16 @@ class KickStart(object):
line = line.strip()
lineno += 1
if line and line[0] != '#':
- parsed = parser.parse_args(shlex.split(line))
+ try:
+ parsed = parser.parse_args(shlex.split(line))
+ except ArgumentError as err:
+ raise KickStartError('%s:%d: %s' % \
+ (confpath, lineno, err))
if line.startswith('part'):
self.partitions.append(Partition(parsed, lineno))
else:
if not self.bootloader:
self.bootloader = parsed
else:
- raise KickStartError("Error: more than one bootloader specified")
+ raise KickStartError("%s:%d: more than one bootloader "\
+ "specified" % (confpath, lineno))