[OE-core] [wic patch 1/5] wic: Catch errors during image files clean-up

Ed Bartosh ed.bartosh at linux.intel.com
Tue May 2 12:56:38 UTC 2017


On Fri, Apr 21, 2017 at 02:11:41PM +0200, Andreas J. Reichel wrote:
> Handle exception if a file could not be deleted during clean-up of
> unwanted files, thus preventing a failure of wic in this case.

Can you explain why partition images can't be deleted?
As wic creates them it's not obvious why it can't remove them.

> Signed-off-by: Andreas Reichel <andreas.reichel.ext at siemens.com>
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> Signed-off-by: Daniel Wagner <daniel.wagner at siemens.com>
> 
> ---
>  scripts/lib/wic/plugins/imager/direct.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index f2e6127331..d6b47ff0bb 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -541,7 +541,12 @@ class PartitionedImage():
>      def cleanup(self):
>          # remove partition images
>          for image in set(self.partimages):
> -            os.remove(image)
> +            try:
> +                os.remove(image)
> +            except IOError as e:
> +                logger.warning(
> +                    "Could not delete file. {0}: I/O error ({1}): {2}\n".format(
> +                    image, e.errno, e.strerror))
>  
>      def assemble(self):
>          logger.debug("Installing partitions")
> -- 
> 2.11.0
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
--
Regards,
Ed



More information about the Openembedded-core mailing list