Amend mic cr option of run_script. 24/151524/2
authoryangyuhuan <yuhuan.yang@samsung.com>
Thu, 21 Sep 2017 15:04:29 +0000 (23:04 +0800)
committeryangyuhuan <yuhuan.yang@samsung.com>
Thu, 21 Sep 2017 15:08:08 +0000 (23:08 +0800)
Change-Id: Ifbf6569ead73a10390f883cf47ba22abba90a4c3

plugins/imager/fs_plugin.py
plugins/imager/loop_plugin.py
plugins/imager/qcow_plugin.py
plugins/imager/raw_plugin.py

index a6b5cf8..b2701a0 100755 (executable)
@@ -17,7 +17,7 @@
 
 import subprocess
 from mic import chroot, msger, rt_util
-from mic.utils import misc, errors, fs_related
+from mic.utils import misc, errors, fs_related, runner
 from mic.imager import fs
 from mic.conf import configmgr
 from mic.plugin import pluginmgr
@@ -118,10 +118,8 @@ class FsPlugin(ImagerPlugin):
         #Run script of --run_script after image created
         if creatoropts['run_script']:
             cmd = creatoropts['run_script']
-            msger.info("Running command in parameter run_script: "+"".join(cmd))
             try:
-                p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
-                p.communicate()
+                runner.show(cmd)
             except OSError,err:
                 msger.warning(str(err))
 
index c3fa67b..6034a29 100755 (executable)
@@ -21,7 +21,7 @@ import shutil
 import tempfile
 
 from mic import chroot, msger, rt_util
-from mic.utils import misc, fs_related, errors
+from mic.utils import misc, fs_related, errors, runner
 from mic.conf import configmgr
 from mic.plugin import pluginmgr
 from mic.imager.loop import LoopImageCreator, load_mountpoints
@@ -123,10 +123,8 @@ class LoopPlugin(ImagerPlugin):
         #Run script of --run_script after image created
         if creatoropts['run_script']:
             cmd = creatoropts['run_script']
-            msger.info("Running command in parameter run_script: "+"".join(cmd))
             try:
-                p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
-                p.communicate()
+                runner.show(cmd)
             except OSError,err:
                 msger.warning(str(err))
 
index 27a712b..39dbad7 100755 (executable)
@@ -154,10 +154,8 @@ class QcowPlugin(ImagerPlugin):
         #Run script of --run_script after image created
         if creatoropts['run_script']:
             cmd = creatoropts['run_script']
-            msger.info("Running command in parameter run_script: "+"".join(cmd))
             try:
-                p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
-                p.communicate()
+                runner.show(cmd)
             except OSError,err:
                 msger.warning(str(err))
 
index 554eac7..1524e74 100755 (executable)
@@ -117,10 +117,8 @@ class RawPlugin(ImagerPlugin):
         #Run script of --run_script after image created
         if creatoropts['run_script']:
             cmd = creatoropts['run_script']
-            msger.info("Running command in parameter run_script: "+"".join(cmd))
             try:
-                p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
-                p.communicate()
+                runner.show(cmd)
             except OSError,err:
                 msger.warning(str(err))