From 26525f2f4f290d2ac5430c70c8a137aa0a0d6f32 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Sun, 1 Mar 2020 21:39:56 -0800 Subject: 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" (From OE-Core rev: 15d1722950a22649905cf8a5789d3cfe48a2a892) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/lib/wic/engine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 83c42c9987..9ff4394757 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -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), -- cgit v1.2.3-54-g00ecf