]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: raise WicError instead of ImageError and CreatorError
authorEd Bartosh <ed.bartosh@linux.intel.com>
Tue, 14 Feb 2017 21:47:06 +0000 (23:47 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 4 Mar 2017 10:42:30 +0000 (10:42 +0000)
There is no need to raise special exceptions. Raising
WicError should be enough.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
scripts/lib/wic/plugin.py
scripts/lib/wic/plugins/imager/direct.py
scripts/lib/wic/plugins/source/bootimg-pcbios.py
scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py

index 31311adb55a999901277526f75c44bd7ed70495f..0e98da5c7a3611979a33ca74cda7edc04b775be2 100644 (file)
@@ -19,7 +19,7 @@ import os
 import sys
 import logging
 
-from wic.errors import CreatorError
+from wic.errors import WicError
 from wic import pluginbase
 from wic.utils.misc import get_bitbake_var
 
@@ -110,7 +110,7 @@ class PluginMgr():
         """ the return value is dict of name:class pairs """
 
         if ptype not in PLUGIN_TYPES:
-            raise CreatorError('%s is not valid plugin type' % ptype)
+            raise WicError('%s is not valid plugin type' % ptype)
 
         plugins_dir = self._build_plugin_dir_list(self.plugin_dir, ptype)
 
index 9c8a2304a73f644e320edf40432a9ca4f42f06e5..5b20ca9c5ba5191f77694a457f066efbae3a1017 100644 (file)
@@ -32,7 +32,7 @@ import uuid
 
 from time import strftime
 
-from wic.errors import ImageError, WicError
+from wic.errors import WicError
 from wic.filemap import sparse_copy
 from wic.ksparser import KickStart, KickStartError
 from wic.plugin import pluginmgr
@@ -355,8 +355,8 @@ class PartitionedImage():
                 # The --part-type can also be implemented for MBR partitions,
                 # in which case it would map to the 1-byte "partition type"
                 # filed at offset 3 of the partition entry.
-                raise ImageError("setting custom partition type is not " \
-                                 "implemented for msdos partitions")
+                raise WicError("setting custom partition type is not " \
+                               "implemented for msdos partitions")
 
             # Get the disk where the partition is located
             self.numpart += 1
index 2ded2dac52c0dd6934480b6bb0720b22915cc5cf..c3a0e4eb421b7e6dd84b7fcc6a858ac788aa5dee 100644 (file)
@@ -28,7 +28,7 @@ import logging
 import os
 
 from wic.engine import get_custom_config
-from wic.errors import ImageError, WicError
+from wic.errors import WicError
 from wic.utils import runner
 from wic.pluginbase import SourcePlugin
 from wic.utils.misc import (exec_cmd, exec_native_cmd,
@@ -71,7 +71,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         rcode = runner.show(['dd', 'if=%s' % mbrfile,
                              'of=%s' % full_path, 'conv=notrunc'])
         if rcode != 0:
-            raise ImageError("Unable to set MBR to %s" % full_path)
+            raise WicError("Unable to set MBR to %s" % full_path)
 
     @classmethod
     def do_configure_partition(cls, part, source_params, creator, cr_workdir,
index 4cc3a39856f3d6a940251c86fc62b1462540ed1d..cf0eec2fe350f8cd3976274aa5d54bf1da92e166 100644 (file)
@@ -22,7 +22,7 @@ import logging
 import os
 import re
 
-from wic.errors import ImageError, WicError
+from wic.errors import WicError
 from wic.utils import runner
 from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd
 from wic.pluginbase import SourcePlugin
@@ -210,4 +210,4 @@ class RootfsPlugin(SourcePlugin):
 
         ret_code = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc'])
         if ret_code != 0:
-            raise ImageError("Unable to set MBR to %s" % full_path)
+            raise WicError("Unable to set MBR to %s" % full_path)