Change in vdsm[master]: Add input parameter to _logExec

juan.hernandez at redhat.com juan.hernandez at redhat.com
Thu Sep 20 15:39:32 UTC 2012


Juan Hernandez has uploaded a new change for review.

Change subject: Add input parameter to _logExec
......................................................................

Add input parameter to _logExec

This allows the use of _logExec when some text has to be provided in the
standard input of the executed command.

Change-Id: I7538464da071fec7a93934f7734abc4b15d707cf
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M vdsm_reg/deployUtil.py.in
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/8095/1

diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index bbda70e..0ce5fca 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -111,7 +111,7 @@
     else:
         return False
 
-def _logExec(argv):
+def _logExec(argv, input=None):
     """
         This function executes a given shell command while logging it.
     """
@@ -120,8 +120,12 @@
     rc = None
     try:
         logging.debug(argv)
-        p = subprocess.Popen(argv , stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        out, err = p.communicate()
+        stdin = None
+        if input is not None:
+            logging.debug(input)
+            stdin = subprocess.PIPE
+        p = subprocess.Popen(argv , stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        out, err = p.communicate(input)
         rc = p.returncode
         logging.debug(out)
         logging.debug(err)


--
To view, visit http://gerrit.ovirt.org/8095
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7538464da071fec7a93934f7734abc4b15d707cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>


More information about the vdsm-patches mailing list