Explorar o código

AMBARI-9891. Ambari-agent stop on Ubuntu fails (aonishuk)

Andrew Onishuk %!s(int64=10) %!d(string=hai) anos
pai
achega
b432db1c78
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      ambari-common/src/main/python/ambari_commons/shell.py

+ 3 - 2
ambari-common/src/main/python/ambari_commons/shell.py

@@ -161,8 +161,9 @@ class shellRunnerLinux:
     if isinstance(script, list):
       cmd = " ".join(script)
 
-    p = subprocess.Popen(cmd, preexec_fn=_changeUid, stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE, shell=True, close_fds=True)
+    cmd_list = ["/bin/bash","--login","--noprofile","-c", cmd]
+    p = subprocess.Popen(cmd_list, preexec_fn=_changeUid, stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE, shell=False, close_fds=True)
     out, err = p.communicate()
     code = p.wait()
     logger.debug("Exitcode for %s is %d" % (cmd, code))