|
@@ -20,31 +20,46 @@
|
|
|
|
|
|
import Ember from 'ember';
|
|
import Ember from 'ember';
|
|
|
|
|
|
-function getYarnHttpProtocolScheme(rmhost, application) {
|
|
|
|
|
|
+function getConfigFromYarn(rmhost, application, config) {
|
|
var httpUrl = window.location.protocol + '//' +
|
|
var httpUrl = window.location.protocol + '//' +
|
|
(ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost;
|
|
(ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost;
|
|
|
|
|
|
- httpUrl += '/conf?name=yarn.http.policy';
|
|
|
|
- Ember.Logger.log("yarn.http.policy URL is: " + httpUrl);
|
|
|
|
|
|
+ httpUrl += '/conf?name=' + config;
|
|
|
|
+ Ember.Logger.log("The RM URL is: " + httpUrl);
|
|
|
|
|
|
- var protocolScheme = "";
|
|
|
|
- $.ajax({
|
|
|
|
- type: 'GET',
|
|
|
|
- dataType: 'json',
|
|
|
|
- async: false,
|
|
|
|
- context: this,
|
|
|
|
- url: httpUrl,
|
|
|
|
- success: function(data) {
|
|
|
|
- protocolScheme = data.property.value;
|
|
|
|
- Ember.Logger.log("Protocol scheme from RM: " + protocolScheme);
|
|
|
|
|
|
+ var configValue = "";
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'GET',
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ async: false,
|
|
|
|
+ context: this,
|
|
|
|
+ url: httpUrl,
|
|
|
|
+ success: function(data) {
|
|
|
|
+ configValue = data.property.value;
|
|
|
|
+ Ember.Logger.log("Value of the config returned from RM: " + configValue);
|
|
|
|
|
|
- application.advanceReadiness();
|
|
|
|
- },
|
|
|
|
- error: function() {
|
|
|
|
- application.advanceReadiness();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- return protocolScheme;
|
|
|
|
|
|
+ application.advanceReadiness();
|
|
|
|
+ },
|
|
|
|
+ error: function() {
|
|
|
|
+ application.advanceReadiness();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return configValue;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function getJHSURL(rmhost, application, isHttpsSchemeEnabled) {
|
|
|
|
+ Ember.Logger.log("getJHSURL, params:rmhost=" + rmhost + ",application=" + application + ",isHttpsSchemeEnabled=" + isHttpsSchemeEnabled);
|
|
|
|
+ var config = '';
|
|
|
|
+ if (isHttpsSchemeEnabled) {
|
|
|
|
+ config = 'mapreduce.jobhistory.webapp.https.address';
|
|
|
|
+ } else {
|
|
|
|
+ config = 'mapreduce.jobhistory.webapp.address';
|
|
|
|
+ }
|
|
|
|
+ return getConfigFromYarn(rmhost, application, config);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function getYarnHttpProtocolScheme(rmhost, application) {
|
|
|
|
+ return getConfigFromYarn(rmhost, application, 'yarn.http.policy');
|
|
}
|
|
}
|
|
|
|
|
|
function getTimeLineURL(rmhost, isHttpsSchemeEnabled) {
|
|
function getTimeLineURL(rmhost, isHttpsSchemeEnabled) {
|
|
@@ -134,6 +149,21 @@ function getNodeManagerPort(rmhost, application) {
|
|
return port;
|
|
return port;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function transformURL(url, hostname) {
|
|
|
|
+ // Deleting the scheme from the beginning of the url
|
|
|
|
+ url = url.replace(/(^\w+:|^)\/\//, '');
|
|
|
|
+
|
|
|
|
+ var address = url.split(":")[0];
|
|
|
|
+ var port = url.split(":")[1];
|
|
|
|
+ // Instead of localhost, use the name of the host
|
|
|
|
+ if (address === "0.0.0.0" || address === "localhost") {
|
|
|
|
+ url = hostname + ":" + port;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Ember.Logger.log("The transformed URL is: " + url);
|
|
|
|
+ return url;
|
|
|
|
+}
|
|
|
|
+
|
|
function updateConfigs(application) {
|
|
function updateConfigs(application) {
|
|
var hostname = window.location.hostname;
|
|
var hostname = window.location.hostname;
|
|
var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') +
|
|
var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') +
|
|
@@ -162,6 +192,13 @@ function updateConfigs(application) {
|
|
Ember.Logger.log("NodeMananger port: " + nodeManagerPort);
|
|
Ember.Logger.log("NodeMananger port: " + nodeManagerPort);
|
|
ENV.nodeManagerPort = nodeManagerPort;
|
|
ENV.nodeManagerPort = nodeManagerPort;
|
|
|
|
|
|
|
|
+ if (!ENV.hosts.jhsAddress) {
|
|
|
|
+ var jhsAddress = getJHSURL(rmhost, application, isHttpsSchemeEnabled);
|
|
|
|
+ jhsAddress = transformURL(jhsAddress, hostname);
|
|
|
|
+ Ember.Logger.log("The JHS address is " + jhsAddress);
|
|
|
|
+ ENV.hosts.jhsAddress = jhsAddress;
|
|
|
|
+ }
|
|
|
|
+
|
|
if(!ENV.hosts.timelineWebAddress) {
|
|
if(!ENV.hosts.timelineWebAddress) {
|
|
var timelinehost = "";
|
|
var timelinehost = "";
|
|
$.ajax({
|
|
$.ajax({
|
|
@@ -172,19 +209,10 @@ function updateConfigs(application) {
|
|
url: getTimeLineURL(rmhost, isHttpsSchemeEnabled),
|
|
url: getTimeLineURL(rmhost, isHttpsSchemeEnabled),
|
|
success: function(data) {
|
|
success: function(data) {
|
|
timelinehost = data.property.value;
|
|
timelinehost = data.property.value;
|
|
- timelinehost = timelinehost.replace(/(^\w+:|^)\/\//, '');
|
|
|
|
|
|
+ timelinehost = transformURL(timelinehost, hostname);
|
|
ENV.hosts.timelineWebAddress = timelinehost;
|
|
ENV.hosts.timelineWebAddress = timelinehost;
|
|
-
|
|
|
|
- var address = timelinehost.split(":")[0];
|
|
|
|
- var port = timelinehost.split(":")[1];
|
|
|
|
-
|
|
|
|
Ember.Logger.log("Timeline Address from RM: " + timelinehost);
|
|
Ember.Logger.log("Timeline Address from RM: " + timelinehost);
|
|
|
|
|
|
- if(address === "0.0.0.0" || address === "localhost") {
|
|
|
|
- var updatedAddress = hostname + ":" + port;
|
|
|
|
- ENV.hosts.timelineWebAddress = updatedAddress;
|
|
|
|
- Ember.Logger.log("Timeline Updated Address: " + updatedAddress);
|
|
|
|
- }
|
|
|
|
application.advanceReadiness();
|
|
application.advanceReadiness();
|
|
},
|
|
},
|
|
error: function() {
|
|
error: function() {
|
|
@@ -206,19 +234,10 @@ function updateConfigs(application) {
|
|
url: getTimeLineV1URL(rmhost, isHttpsSchemeEnabled),
|
|
url: getTimeLineV1URL(rmhost, isHttpsSchemeEnabled),
|
|
success: function(data) {
|
|
success: function(data) {
|
|
timelinehost = data.property.value;
|
|
timelinehost = data.property.value;
|
|
- timelinehost = timelinehost.replace(/(^\w+:|^)\/\//, '');
|
|
|
|
|
|
+ timelinehost = transformURL(timelinehost, hostname);
|
|
ENV.hosts.timelineV1WebAddress = timelinehost;
|
|
ENV.hosts.timelineV1WebAddress = timelinehost;
|
|
-
|
|
|
|
- var address = timelinehost.split(":")[0];
|
|
|
|
- var port = timelinehost.split(":")[1];
|
|
|
|
-
|
|
|
|
Ember.Logger.log("Timeline V1 Address from RM: " + timelinehost);
|
|
Ember.Logger.log("Timeline V1 Address from RM: " + timelinehost);
|
|
|
|
|
|
- if(address === "0.0.0.0" || address === "localhost") {
|
|
|
|
- var updatedAddress = hostname + ":" + port;
|
|
|
|
- ENV.hosts.timelineV1WebAddress = updatedAddress;
|
|
|
|
- Ember.Logger.log("Timeline V1 Updated Address: " + updatedAddress);
|
|
|
|
- }
|
|
|
|
application.advanceReadiness();
|
|
application.advanceReadiness();
|
|
},
|
|
},
|
|
error: function() {
|
|
error: function() {
|