Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] wic/direct.py: Avoid exception if using multiple rawcopy/no-table entries.
@ 2017-03-09  7:25 Kristian Amlie
  2017-03-09 13:28 ` Ed Bartosh
  0 siblings, 1 reply; 3+ messages in thread
From: Kristian Amlie @ 2017-03-09  7:25 UTC (permalink / raw)
  To: openembedded-core

If we are both having a bootloader and a U-Boot environment file, we
can end up with two entries using "--source rawcopy" and "--no-table",
and since they reuse the same file [1], their cleanup handlers will
try to delete the same file twice. So just ignore the error if the
file doesn't exist.

[1] Although they reuse the same file, the resulting output is
correct, so it appears the file is accessed in properly sequential
order.

Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
 scripts/lib/wic/plugins/imager/direct.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index b7e324a..0e8d436 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -548,7 +548,10 @@ class PartitionedImage():
     def cleanup(self):
         # remove partition images
         for image in self.partimages:
-            os.remove(image)
+            try:
+                os.remove(image)
+            except FileNotFoundError:
+                pass
 
     def assemble(self):
         logger.debug("Installing partitions")
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-09 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-09  7:25 [PATCH] wic/direct.py: Avoid exception if using multiple rawcopy/no-table entries Kristian Amlie
2017-03-09 13:28 ` Ed Bartosh
2017-03-09 14:37   ` [PATCH v2] " Kristian Amlie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox