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

This commit is contained in:
Rohith Sharma K S 2018-05-17 16:24:51 +05:30
parent 454de3b543
commit c95795cd8f

View File

@ -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+:|^)\/\//, '');