Amend mic cr option of run_script
authoryuhuan.yang <yuhuan.yang@123.com>
Mon, 17 Jul 2017 16:12:38 +0000 (00:12 +0800)
committeryuhuan.yang <yuhuan.yang@123.com>
Mon, 11 Sep 2017 13:18:20 +0000 (21:18 +0800)
Change-Id: Ib088fb9d56b08c9aeae01908827f5507d972cdec

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

index a6b5cf8034b0f76eb5933c4a825b602a6545c970..b2701a04117827aebf4539faca53aa0a5dfa7ae9 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 c3fa67b755fcdda418a7a4ec96a306ba51f16ddc..6034a29b1e54e13ae359a7dd529fae65f9f927b9 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 27a712b2cc46324e4fbb4c23ca509a3594f73cd6..a81e2918b18d8d6e97b5de63cbd00e2c5afb7a83 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 554eac76902fa06c7e2caa2a523f48067f248685..1524e748a60ec3eda616d3ca316f9670cfbfad27 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))