You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2016/02/17 20:13:05 UTC

ambari git commit: AMBARI-15020: HAWQ service check fails when PXF is present due to cmd syntax error (bhuvnesh2703 via jaoki)

Repository: ambari
Updated Branches:
  refs/heads/trunk 4124ae032 -> c282a0eec


AMBARI-15020: HAWQ service check fails when PXF is present due to cmd syntax error (bhuvnesh2703 via jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c282a0ee
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c282a0ee
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c282a0ee

Branch: refs/heads/trunk
Commit: c282a0eec34809290be93a4c08f6686948ff896f
Parents: 4124ae0
Author: Jun Aoki <ja...@apache.org>
Authored: Wed Feb 17 11:12:57 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Wed Feb 17 11:12:57 2016 -0800

----------------------------------------------------------------------
 .../common-services/HAWQ/2.0.0/package/scripts/utils.py   | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c282a0ee/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
index 51a38d1..f40e982 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
@@ -79,12 +79,8 @@ def exec_ssh_cmd(hostname, cmd):
   """
   Runs the command on the remote host as gpadmin user
   """
-  import params
   # Only gpadmin should be allowed to run command via ssh, thus not exposing user as a parameter
-  if params.hostname != hostname:
-    cmd = "su - {0} -c 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {1} \"{2} \" '".format(hawq_constants.hawq_user, hostname, cmd)
-  else:
-    cmd = "su - {0} -c \"{1}\"".format(hawq_constants.hawq_user, cmd)
+  cmd = "su - {0} -c \"ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {1} \\\"{2} \\\" \"".format(hawq_constants.hawq_user, hostname, cmd)
   Logger.info("Command executed: {0}".format(cmd))
   process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
   (stdout, stderr) = process.communicate()
@@ -97,9 +93,9 @@ def exec_psql_cmd(command, host, port, db="template1", tuples_only=True):
   """
   src_cmd = "export PGPORT={0} && source {1}".format(port, hawq_constants.hawq_greenplum_path_file)
   if tuples_only:
-    cmd = src_cmd + " && psql -d {0} -c \\\"{1};\\\"".format(db, command)
+    cmd = src_cmd + " && psql -d {0} -c \\\\\\\"{1};\\\\\\\"".format(db, command)
   else:
-    cmd = src_cmd + " && psql -t -d {0} -c \\\"{1};\\\"".format(db, command)
+    cmd = src_cmd + " && psql -t -d {0} -c \\\\\\\"{1};\\\\\\\"".format(db, command)
   retcode, out, err = exec_ssh_cmd(host, cmd)
   if retcode:
     Logger.error("SQL command executed failed: {0}\nReturncode: {1}\nStdout: {2}\nStderr: {3}".format(cmd, retcode, out, err))