Repository: hadoop
Updated Branches:
  refs/heads/branch-3.1 1d1806f86 -> 4222e8f21


YARN-8297. Incorrect ATS Url used for Wire encrypted cluster. Contributed by 
Sunil G.

(cherry picked from commit c95795cd8f649c45f05df1d5faa1dcabd30d7a6e)


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

Branch: refs/heads/branch-3.1
Commit: 4222e8f21bf62ec9350205e572b26547fab1f96b
Parents: 1d1806f
Author: Rohith Sharma K S <rohithsharm...@apache.org>
Authored: Thu May 17 16:24:51 2018 +0530
Committer: Rohith Sharma K S <rohithsharm...@apache.org>
Committed: Thu May 17 16:25:38 2018 +0530

----------------------------------------------------------------------
 .../src/main/webapp/app/initializers/loader.js  | 50 +++++++++++++++++---
 1 file changed, 44 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4222e8f2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
index 83df971..43b5065 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js
@@ -20,20 +20,57 @@
 
 import Ember from 'ember';
 
-function getTimeLineURL(rmhost) {
+function getYarnHttpProtocolScheme(rmhost, application) {
+  var httpUrl = window.location.protocol + '//' +
+    (ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + 
rmhost;
+
+  httpUrl += '/conf?name=yarn.http.policy';
+  Ember.Logger.log("yarn.http.policy URL is: " + httpUrl);
+
+  var protocolScheme = "";
+  $.ajax({
+    type: 'GET',
+    dataType: 'json',
+    async: true,
+    context: this,
+    url: httpUrl,
+    success: function(data) {
+      protocolScheme = data.property.value;
+      Ember.Logger.log("Protocol scheme from RM: " + protocolScheme);
+
+      application.advanceReadiness();
+    },
+    error: function() {
+      application.advanceReadiness();
+    }
+  });
+  return protocolScheme == "HTTPS_ONLY";
+}
+
+function getTimeLineURL(rmhost, isHttpsSchemeEnabled) {
   var url = window.location.protocol + '//' +
     (ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + 
rmhost;
 
-  url += '/conf?name=yarn.timeline-service.reader.webapp.address';
+  if(isHttpsSchemeEnabled) {
+    url += '/conf?name=yarn.timeline-service.reader.webapp.https.address';
+  } else {
+    url += '/conf?name=yarn.timeline-service.reader.webapp.address';
+  }
+
   Ember.Logger.log("Get Timeline V2 Address URL: " + url);
   return url;
 }
 
-function getTimeLineV1URL(rmhost) {
+function getTimeLineV1URL(rmhost, isHttpsSchemeEnabled) {
   var url = window.location.protocol + '//' +
     (ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + 
rmhost;
 
-  url += '/conf?name=yarn.timeline-service.webapp.address';
+  if(isHttpsSchemeEnabled) {
+    url += '/conf?name=yarn.timeline-service.webapp.https.address';
+  } else {
+    url += '/conf?name=yarn.timeline-service.webapp.address';
+  }
+
   Ember.Logger.log("Get Timeline V1 Address URL: " + url);
   return url;
 }
@@ -51,6 +88,7 @@ function updateConfigs(application) {
 
   Ember.Logger.log("RM Address: " + rmhost);
 
+  var isHttpsSchemeEnabled = getYarnHttpProtocolScheme(rmhost, application);
   if(!ENV.hosts.timelineWebAddress) {
     var timelinehost = "";
     $.ajax({
@@ -58,7 +96,7 @@ function updateConfigs(application) {
       dataType: 'json',
       async: true,
       context: this,
-      url: getTimeLineURL(rmhost),
+      url: getTimeLineURL(rmhost, isHttpsSchemeEnabled),
       success: function(data) {
         timelinehost = data.property.value;
         timelinehost = timelinehost.replace(/(^\w+:|^)\/\//, '');
@@ -92,7 +130,7 @@ function updateConfigs(application) {
       dataType: 'json',
       async: true,
       context: this,
-      url: getTimeLineV1URL(rmhost),
+      url: getTimeLineV1URL(rmhost, isHttpsSchemeEnabled),
       success: function(data) {
         timelinehost = data.property.value;
         timelinehost = timelinehost.replace(/(^\w+:|^)\/\//, '');


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to