Repository: hadoop
Updated Branches:
  refs/heads/trunk 454de3b54 -> c95795cd8


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


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

Branch: refs/heads/trunk
Commit: c95795cd8f649c45f05df1d5faa1dcabd30d7a6e
Parents: 454de3b
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:24:51 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/c95795cd/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