Check if ks file exists
authorGui Chen <gui.chen@intel.com>
Wed, 19 Oct 2011 08:31:37 +0000 (16:31 +0800)
committerGui Chen <gui.chen@intel.com>
Wed, 19 Oct 2011 08:31:37 +0000 (16:31 +0800)
Signed-off-by: Gui Chen <gui.chen@intel.com>
plugins/imager/fs_plugin.py
plugins/imager/livecd_plugin.py
plugins/imager/liveusb_plugin.py
plugins/imager/loop_plugin.py
plugins/imager/raw_plugin.py

index e52a9ed..45f9960 100644 (file)
@@ -44,6 +44,9 @@ class FsPlugin(ImagerPlugin):
         createopts = cfgmgr.create
         ksconf = args[0]
 
+        if not os.path.exists(ksconf):
+            raise errors.CreatorError("Can't find the file: %s" % ksconf)
+
         recording_pkgs = []
         if len(createopts['record_pkgs']) > 0:
             recording_pkgs = createopts['record_pkgs']
index d1c2bb7..5e8682e 100644 (file)
@@ -45,6 +45,9 @@ class LiveCDPlugin(ImagerPlugin):
         creatoropts = cfgmgr.create
         ksconf = args[0]
 
+        if not os.path.exists(ksconf):
+            raise errors.CreatorError("Can't find the file: %s" % ksconf)
+
         if creatoropts['arch'] and creatoropts['arch'].startswith('arm'):
             msger.warning('livecd cannot support arm images, Quit')
             return
index e52b6e7..02ad769 100644 (file)
@@ -47,6 +47,9 @@ class LiveUSBPlugin(ImagerPlugin):
         creatoropts = cfgmgr.create
         ksconf = args[0]
 
+        if not os.path.exists(ksconf):
+            raise errors.CreatorError("Can't find the file: %s" % ksconf)
+
         if creatoropts['arch'] and creatoropts['arch'].startswith('arm'):
             msger.warning('liveusb cannot support arm images, Quit')
             return
index 8332dcb..991f439 100644 (file)
@@ -46,6 +46,9 @@ class LoopPlugin(ImagerPlugin):
         creatoropts = cfgmgr.create
         ksconf = args[0]
 
+        if not os.path.exists(ksconf):
+            raise errors.CreatorError("Can't find the file: %s" % ksconf)
+
         recording_pkgs = []
         if len(creatoropts['record_pkgs']) > 0:
             recording_pkgs = creatoropts['record_pkgs']
index 132ec9c..5ae1a9a 100644 (file)
@@ -48,6 +48,9 @@ class RawPlugin(ImagerPlugin):
         creatoropts = cfgmgr.create
         ksconf = args[0]
 
+        if not os.path.exists(ksconf):
+            raise errors.CreatorError("Can't find the file: %s" % ksconf)
+
         recording_pkgs = []
         if len(creatoropts['record_pkgs']) > 0:
             recording_pkgs = creatoropts['record_pkgs']