Change in vdsm[master]: util: fix execCmd to accept tuples

dkuznets at redhat.com dkuznets at redhat.com
Tue Mar 25 12:44:03 UTC 2014


Dima Kuznetsov has uploaded a new change for review.

Change subject: util: fix execCmd to accept tuples
......................................................................

util: fix execCmd to accept tuples

There was an issue when occasionally when flags were given along with a
command in a tuple, there was an exception in execCmd, because +
operator was used to append tuple with commands to a list.

Change-Id: I8d1269d9a26b1fef1552976ae626cf4596471283
Signed-off-by: Dima Kuznetsov <dkuznets at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/26070/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index b682dec..430f46d 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -660,18 +660,22 @@
         if ioclassdata is not None:
             command.extend(("-n", str(ioclassdata)))
 
-        command = command + cmd
+        command = itertools.chain(command, cmd)
 
     if nice is not None:
-        command = [constants.EXT_NICE, '-n', str(nice)] + command
+        command = itertools.chain([constants.EXT_NICE, '-n', str(nice)],
+                                  command)
 
     if setsid:
-        command = [constants.EXT_SETSID] + command
+        command = itertools.chain([constants.EXT_SETSID], command)
 
     if sudo:
         if os.geteuid() != 0:
-            command = [constants.EXT_SUDO, SUDO_NON_INTERACTIVE_FLAG] + command
+            command = itertools.chain([constants.EXT_SUDO,
+                                       SUDO_NON_INTERACTIVE_FLAG],
+                                      command)
 
+    command = list(command)
     if not printable:
         printable = command
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d1269d9a26b1fef1552976ae626cf4596471283
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets at redhat.com>


More information about the vdsm-patches mailing list