Change in vdsm[master]: execCmd with sudo=root raise require tty fault when running ...

ybronhei at redhat.com ybronhei at redhat.com
Sun Jan 26 14:53:20 UTC 2014


Yaniv Bronhaim has uploaded a new change for review.

Change subject: execCmd with sudo=root raise require tty fault when running as root
......................................................................

execCmd with sudo=root raise require tty fault when running as root

As default sudo request requires tty, although we define notty for user
vdsm, if we'll try to call sudo command as another use (also root) we
will be blocked by the "sorry you must have tty" to execute sudo
command. To avoid that, this patch ignores sudo=True parameter in
execCmd while running as root.

Change-Id: Iba4175061fe9500ce912a319f63cde9a8b62ab63
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/23721/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index a7e2320..917dc36 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -546,7 +546,8 @@
         command = [constants.EXT_SETSID] + command
 
     if sudo:
-        command = [constants.EXT_SUDO, SUDO_NON_INTERACTIVE_FLAG] + command
+        if os.geteuid() != 0:
+            command = [constants.EXT_SUDO, SUDO_NON_INTERACTIVE_FLAG] + command
 
     if not printable:
         printable = command


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba4175061fe9500ce912a319f63cde9a8b62ab63
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list