]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic/engine: lets display an error not a traceback
authorArmin Kuster <akuster808@gmail.com>
Mon, 2 Mar 2020 05:39:56 +0000 (21:39 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 2 Mar 2020 20:57:24 +0000 (20:57 +0000)
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>
scripts/lib/wic/engine.py

index 83c42c998794f67c9d8e4066723e5929956689f8..9ff43947575a4213d32be9fa3f0dc31f46d3e52e 100644 (file)
@@ -291,7 +291,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:
@@ -314,6 +314,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),