summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2020-03-01 21:39:56 -0800
committerArmin Kuster <akuster808@gmail.com>2020-03-10 19:15:57 -0700
commit29a1d9bed5bf7ed024870a0323f9afdf88346e4d (patch)
tree06e792e6210649710f22278422c028816b8c9845
parenta01bf79a35c908d6b072b984608114860b5c1e8f (diff)
downloadopenembedded-core-contrib-29a1d9bed5bf7ed024870a0323f9afdf88346e4d.tar.gz
wic/engine: lets display an error not a traceback
If the requested partition does not exist in this request "wic ls {path}:pnum" display a nice message not a trackback Also fix displaying the pnum and not "%s" Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 15d1722950a22649905cf8a5789d3cfe48a2a892) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--scripts/lib/wic/engine.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 18776fa8a0..4ccca482e7 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -290,7 +290,7 @@ class Disk:
def _get_part_image(self, pnum):
if pnum not in self.partitions:
- raise WicError("Partition %s is not in the image")
+ raise WicError("Partition %s is not in the image" % pnum)
part = self.partitions[pnum]
# check if fstype is supported
for fstype in self.fstypes:
@@ -313,6 +313,9 @@ class Disk:
seek=self.partitions[pnum].start)
def dir(self, pnum, path):
+ if pnum not in self.partitions:
+ raise WicError("Partition %s is not in the image" % pnum)
+
if self.partitions[pnum].fstype.startswith('ext'):
return exec_cmd("{} {} -R 'ls -l {}'".format(self.debugfs,
self._get_part_image(pnum),