You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by bh...@apache.org on 2016/03/24 18:24:46 UTC

ambari git commit: AMBARI-15550: PXF should use hostname instead of localhost in pxf urls (bhuvnesh2703)

Repository: ambari
Updated Branches:
  refs/heads/trunk 17697bb37 -> c4bcceace


AMBARI-15550: PXF should use hostname instead of localhost in pxf urls (bhuvnesh2703)


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

Branch: refs/heads/trunk
Commit: c4bcceace372f0f6407d0261541ad1728a7c90f5
Parents: 17697bb
Author: Bhuvnesh Chaudhary <bc...@pivotal.io>
Authored: Thu Mar 24 10:25:42 2016 -0700
Committer: Bhuvnesh Chaudhary <bc...@pivotal.io>
Committed: Thu Mar 24 10:25:42 2016 -0700

----------------------------------------------------------------------
 .../common-services/PXF/3.0.0/package/alerts/api_status.py  | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c4bcceac/ambari-server/src/main/resources/common-services/PXF/3.0.0/package/alerts/api_status.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PXF/3.0.0/package/alerts/api_status.py b/ambari-server/src/main/resources/common-services/PXF/3.0.0/package/alerts/api_status.py
index 3134f41..d0ed0a4 100644
--- a/ambari-server/src/main/resources/common-services/PXF/3.0.0/package/alerts/api_status.py
+++ b/ambari-server/src/main/resources/common-services/PXF/3.0.0/package/alerts/api_status.py
@@ -41,8 +41,6 @@ RESULT_STATE_WARNING = 'WARNING'
 
 PXF_PORT = 51200
 
-BASE_URL = "http://localhost:" + str(PXF_PORT) + "/pxf/"
-
 logger = logging.getLogger('ambari_alerts')
 
 commonPXFHeaders = {
@@ -110,12 +108,12 @@ def _makeHTTPCall(url, header={}, body=None):
     raise e
 
 
-def _get_pxf_protocol_version():
+def _get_pxf_protocol_version(base_url):
   """
   Gets the pxf protocol version number
   """
   logger.info("Fetching PXF protocol version")
-  url = BASE_URL + "ProtocolVersion"
+  url = base_url + "ProtocolVersion"
   try:
     response = _makeHTTPCall(url)
   except Exception as e:
@@ -133,6 +131,7 @@ def _get_pxf_protocol_version():
   raise Exception("version could not be found in response " + response)
 
 def execute(configurations={}, parameters={}, host_name=None):
+  BASE_URL = "http://{0}:{1}/pxf/".format(host_name, PXF_PORT)
   try:
     # Get delegation token if security is enabled
     if CLUSTER_ENV_SECURITY in configurations and configurations[CLUSTER_ENV_SECURITY].lower() == "true":
@@ -148,7 +147,7 @@ def execute(configurations={}, parameters={}, host_name=None):
                                      None)
       commonPXFHeaders.update({"X-GP-TOKEN": token})
 
-    if _get_pxf_protocol_version().startswith("v"):
+    if _get_pxf_protocol_version(BASE_URL).startswith("v"):
       return (RESULT_STATE_OK, ['PXF is functional'])
 
     message = "Unable to determine PXF version"