ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject git commit: AMBARI-4095. Quick links should work after reconfiguring ports for master components. (jaimin)
Date Tue, 17 Dec 2013 23:56:20 GMT
Updated Branches:
  refs/heads/trunk b12c19c3c -> ac46ed490


AMBARI-4095. Quick links should work after reconfiguring ports for master components. (jaimin)


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

Branch: refs/heads/trunk
Commit: ac46ed4908b37185016f627d4091f7e6de2990cb
Parents: b12c19c
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Tue Dec 17 15:55:53 2013 -0800
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Tue Dec 17 15:55:59 2013 -0800

----------------------------------------------------------------------
 ambari-web/app/models/quick_links.js            | 248 +++++++++++++++----
 .../app/views/common/quick_view_link_view.js    | 130 ++++++----
 2 files changed, 278 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ac46ed49/ambari-web/app/models/quick_links.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/quick_links.js b/ambari-web/app/models/quick_links.js
index 43a6bc5..4c308bb 100644
--- a/ambari-web/app/models/quick_links.js
+++ b/ambari-web/app/models/quick_links.js
@@ -17,147 +17,254 @@
  */
 
 var App = require('app');
+var portRegex = '\\w*:(\\d+)';
 
 App.QuickLinks = DS.Model.extend({
   label: DS.attr('string'),
   url: DS.attr('string'),
   service_id: DS.attr('string'),
-  template: DS.attr('string')
+  template: DS.attr('string'),
+  http_config: DS.attr('string'),
+  https_config: DS.attr('string'),
+  site: DS.attr('string'),
+  regex: DS.attr('string'),
+  default_http_port: DS.attr('number'),
+  default_https_port: DS.attr('number')
 });
 
+
 App.QuickLinks.FIXTURES = [
   {
     id:1,
     label:'NameNode UI',
-    url:'%@://%@:50070/dfshealth.jsp',
+    url:'%@://%@:%@/dfshealth.jsp',
     service_id: 'HDFS',
-    template:'%@://%@:50070/dfshealth.jsp'
+    template:'%@://%@:%@/dfshealth.jsp',
+    http_config: 'dfs.namenode.http-address',
+    https_config: 'dfs.namenode.https-address',
+    site: 'hdfs-site',
+    regex: portRegex,
+    default_http_port: 50070,
+    default_https_port: 50470
   },
   {
     id:2,
     label:'NameNode logs',
-    url:'%@://%@:50070/logs',
+    url:'%@://%@:%@/logs',
     service_id: 'HDFS',
-    template:'%@://%@:50070/logs'
+    template:'%@://%@:%@/logs',
+    http_config: 'dfs.namenode.http-address',
+    https_config: 'dfs.namenode.https-address',
+    site: 'hdfs-site',
+    regex: portRegex,
+    default_http_port: 50070,
+    default_https_port: 50470
   },
   {
     id:3,
     label:'NameNode JMX',
-    url:'%@://%@:50070/jmx',
+    url:'%@://%@:%@/jmx',
     service_id: 'HDFS',
-    template:'%@://%@:50070/jmx'
+    template:'%@://%@:%@/jmx',
+    http_config: 'dfs.namenode.http-address',
+    https_config: 'dfs.namenode.https-address',
+    site: 'hdfs-site',
+    regex: portRegex,
+    default_http_port: 50070,
+    default_https_port: 50470
   },
   {
     id:4,
     label:'Thread Stacks',
-    url:'%@://%@:50070/stacks',
+    url:'%@://%@:%@/stacks',
     service_id: 'HDFS',
-    template:'%@://%@:50070/stacks'
+    template:'%@://%@:%@/stacks',
+    http_config: 'dfs.namenode.http-address',
+    https_config: 'dfs.namenode.https-address',
+    site: 'hdfs-site',
+    regex: portRegex,
+    default_http_port: 50070,
+    default_https_port: 50470
   },
   {
     id:5,
     label:'JobTracker UI',
-    url:'%@://%@:50030/jobtracker.jsp',
+    url:'%@://%@:%@/jobtracker.jsp',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/jobtracker.jsp'
+    template:'%@://%@:%@/jobtracker.jsp',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:6,
     label:'Scheduling Info',
-    url:'%@://%@:50030/scheduler',
+    url:'%@://%@:%@/scheduler',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/scheduler'
+    template:'%@://%@:%@/scheduler',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:7,
     label:'Running Jobs',
-    url:'%@://%@:50030/jobtracker.jsp#running_jobs',
+    url:'%@://%@:%@/jobtracker.jsp#running_jobs',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/jobtracker.jsp#running_jobs'
+    template:'%@://%@:%@/jobtracker.jsp#running_jobs',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:8,
     label:'Retired Jobs',
-    url:'%@://%@:50030/jobtracker.jsp#retired_jobs',
+    url:'%@://%@:%@/jobtracker.jsp#retired_jobs',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/jobtracker.jsp#retired_jobs'
+    template:'%@://%@:%@/jobtracker.jsp#retired_jobs',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:9,
     label:'JobHistory Server',
-    url:'%@://%@:51111/jobhistoryhome.jsp',
+    url:'%@://%@:%@/jobhistoryhome.jsp',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:51111/jobhistoryhome.jsp'
+    template:'%@://%@:%@/jobhistoryhome.jsp',
+    http_config: 'mapreduce.history.server.http.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 51111
   },
+
   {
     id:10,
     label:'JobTracker Logs',
-    url:'%@://%@:50030/logs',
+    url:'%@://%@:%@/logs',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/logs'
+    template:'%@://%@:%@/logs',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:11,
     label:'JobTracker JMX',
-    url:'%@://%@:50030/jmx',
+    url:'%@://%@:%@/jmx',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/jmx'
+    template:'%@://%@:%@/jmx',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:12,
     label:'Thread Stacks',
-    url:'%@://%@:50030/stacks',
+    url:'%@://%@:%@/stacks',
     service_id: 'MAPREDUCE',
-    template:'%@://%@:50030/stacks'
+    template:'%@://%@:%@/stacks',
+    http_config: 'mapred.job.tracker.http.address',
+    https_config: 'mapred.job.tracker.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 50030,
+    default_https_port: 50035
   },
   {
     id:13,
     label:'HBase Master UI',
-    url:'%@://%@:60010/master-status',
+    url:'%@://%@:%@/master-status',
     service_id: 'HBASE',
-    template:'%@://%@:60010/master-status'
+    template:'%@://%@:%@/master-status',
+    http_config: 'hbase.master.info.port',
+    site: 'hbase-site',
+    regex: '^(\\d+)$',
+    default_http_port: 60010
   },
   {
     id:14,
     label:'HBase Logs',
     url:'%@://%@:60010/logs',
     service_id: 'HBASE',
-    template:'%@://%@:60010/logs'
+    template:'%@://%@:%@/logs',
+    http_config: 'hbase.master.info.port',
+    site: 'hbase-site',
+    regex: '^(\\d+)$',
+    default_http_port: 60010
   },
   {
     id:15,
     label:'Zookeeper Info',
     url:'%@://%@:60010/zk.jsp',
     service_id: 'HBASE',
-    template:'%@://%@:60010/zk.jsp'
+    template:'%@://%@:%@/zk.jsp',
+    http_config: 'hbase.master.info.port',
+    site: 'hbase-site',
+    regex: '^(\\d+)$',
+    default_http_port: 60010
   },
   {
     id:16,
     label:'HBase Master JMX',
     url:'%@://%@:60010/jmx',
     service_id: 'HBASE',
-    template:'%@://%@:60010/jmx'
+    template:'%@://%@:%@/jmx',
+    http_config: 'hbase.master.info.port',
+    site: 'hbase-site',
+    regex: '^(\\d+)$',
+    default_http_port: 60010
   },
   {
     id:17,
     label:'Debug Dump',
-    url:'%@://%@:60010/dump',
+    url:'%@://%@:%@/dump',
     service_id: 'HBASE',
-    template:'%@://%@:60010/dump'
+    template:'%@://%@:%@/dump',
+    http_config: 'hbase.master.info.port',
+    site: 'hbase-site',
+    regex: '^(\\d+)$',
+    default_http_port: 60010
   },
   {
     id:18,
     label:'Thread Stacks',
-    url:'%@://%@:60010/stacks',
+    url:'%@://%@:%@/stacks',
     service_id: 'HBASE',
-    template:'%@://%@:60010/stacks'
+    template:'%@://%@:%@/stacks',
+    http_config: 'hbase.master.info.port',
+    site: 'hbase-site',
+    regex: '^(\\d+)$',
+    default_http_port: 60010
   },
   {
     id:19,
     label:'Oozie Web UI',
-    url:'%@://%@:11000/oozie',
+    url:'%@://%@:%@/oozie',
     service_id: 'OOZIE',
-    template:'%@://%@:11000/oozie'
+    template:'%@://%@:%@/oozie',
+    http_config: 'oozie.base.url',
+    site: 'oozie-site',
+    regex: portRegex,
+    default_http_port: 11000
   },
   {
     id:20,
@@ -186,55 +293,100 @@ App.QuickLinks.FIXTURES = [
     label:'ResourceManager UI',
     url:'%@://%@:%@',
     service_id: 'YARN',
-    template:'%@://%@:%@'
+    template:'%@://%@:%@',
+    http_config: 'yarn.resourcemanager.webapp.address',
+    https_config: 'yarn.resourcemanager.webapp.https.address',
+    site: 'yarn-site',
+    regex: portRegex,
+    default_http_port: 8088,
+    default_https_port: 8090
+
   },
   {
     id:24,
     label:'ResourceManager logs',
     url:'%@://%@:%@/logs',
     service_id: 'YARN',
-    template:'%@://%@:%@/logs'
+    template:'%@://%@:%@/logs',
+    http_config: 'yarn.resourcemanager.webapp.address',
+    https_config: 'yarn.resourcemanager.webapp.https.address',
+    site: 'yarn-site',
+    regex: portRegex,
+    default_http_port: 8088,
+    default_https_port: 8090
   },
   {
     id:25,
     label:'ResourceManager JMX',
     url:'%@://%@:%@/jmx',
     service_id: 'YARN',
-    template:'%@://%@:%@/jmx'
+    template:'%@://%@:%@/jmx',
+    http_config: 'yarn.resourcemanager.webapp.address',
+    https_config: 'yarn.resourcemanager.webapp.https.address',
+    site: 'yarn-site',
+    regex: portRegex,
+    default_http_port: 8088,
+    default_https_port: 8090
   },
   {
     id:26,
     label:'Thread Stacks',
     url:'%@://%@:%@/stacks',
     service_id: 'YARN',
-    template:'%@://%@:%@/stacks'
+    template:'%@://%@:%@/stacks',
+    http_config: 'yarn.resourcemanager.webapp.address',
+    https_config: 'yarn.resourcemanager.webapp.https.address',
+    site: 'yarn-site',
+    regex: portRegex,
+    default_http_port: 8088,
+    default_https_port: 8090
   },
   {
     id:27,
     label:'JobHistory UI',
-    url:'%@://%@:19888',
+    url:'%@://%@:%@',
     service_id: 'MAPREDUCE2',
-    template:'%@://%@:19888'
+    template:'%@://%@:%@',
+    http_config: 'mapreduce.jobhistory.webapp.address',
+    https_config: 'mapreduce.jobhistory.webapp.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 19888
   },
   {
     id:28,
     label:'JobHistory logs',
-    url:'%@://%@:19888/logs',
+    url:'%@://%@:%@/logs',
     service_id: 'MAPREDUCE2',
-    template:'%@://%@:19888/logs'
+    template:'%@://%@:%@/logs',
+    http_config: 'mapreduce.jobhistory.webapp.address',
+    https_config: 'mapreduce.jobhistory.webapp.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 19888
   },
   {
     id:29,
     label:'JobHistory JMX',
-    url:'%@://%@:19888/jmx',
+    url:'%@://%@:%@/jmx',
     service_id: 'MAPREDUCE2',
-    template:'%@://%@:19888/jmx'
+    template:'%@://%@:%@/jmx',
+    http_config: 'mapreduce.jobhistory.webapp.address',
+    https_config: 'mapreduce.jobhistory.webapp.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 19888
   },
   {
     id:30,
     label:'Thread Stacks',
-    url:'%@://%@:19888/stacks',
+    url:'%@://%@:%@/stacks',
     service_id: 'MAPREDUCE2',
-    template:'%@://%@:19888/stacks'
+    template:'%@://%@:%@/stacks',
+    http_config: 'mapreduce.jobhistory.webapp.address',
+    https_config: 'mapreduce.jobhistory.webapp.https.address',
+    site: 'mapred-site',
+    regex: portRegex,
+    default_http_port: 19888
   }
 ];

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac46ed49/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index 6a72a4c..1d09e6d 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -21,8 +21,7 @@ var stringUtils = require('utils/string_utils');
 
 App.QuickViewLinks = Em.View.extend({
 
-
-  loadTags: function() {
+  loadTags: function () {
     App.ajax.send({
       name: 'config.tags.sync',
       sender: this,
@@ -31,43 +30,39 @@ App.QuickViewLinks = Em.View.extend({
     });
   },
 
-  loadTagsSuccess: function(data) {
+  loadTagsSuccess: function (data) {
     var tags = [];
-    for( var prop in data.Clusters.desired_configs){
+    for (var prop in data.Clusters.desired_configs) {
       tags.push(Em.Object.create({
         siteName: prop,
         tagName: data.Clusters.desired_configs[prop]['tag']
       }));
     }
     this.set('actualTags', tags);
-    this.getSecurityProperties();
+    this.setConfigProperties();
   },
 
   actualTags: [],
 
-  securityProperties: [],
+  configProperties: [],
 
   /**
    * list of files that contains properties for enabling/disabling ssl
    */
-  requiredSiteNames: ['core-site'],
+  requiredSiteNames: ['core-site', 'hdfs-site', 'hbase-site', 'oozie-site', 'yarn-site',
'mapred-site'],
 
-  getSecurityProperties: function () {
-    this.set('securityProperties', []);
+  setConfigProperties: function () {
+    this.set('configProperties', []);
     var requiredSiteNames = this.get('requiredSiteNames');
-    var tags = this.get('actualTags').filter(function(tag){
+    var tags = this.get('actualTags').filter(function (tag) {
       return requiredSiteNames.contains(tag.siteName);
     });
     var data = App.router.get('configurationController').getConfigsByTags(tags);
-    var properties = this.get('securityProperties');
-    var coreSiteProperties = data.findProperty('type', 'core-site');
-    if(coreSiteProperties) {
-      properties.pushObject(coreSiteProperties);
-      this.set('securityProperties', properties);
-    }
+    this.set('configProperties', data);
+
   },
 
-  ambariProperties: function() {
+  ambariProperties: function () {
     return App.router.get('clusterController.ambariProperties');
   },
   /**
@@ -75,9 +70,10 @@ App.QuickViewLinks = Em.View.extend({
    */
   quickLinks: [],
 
-  didInsertElement: function() {
+  didInsertElement: function () {
     this.setQuickLinks();
   },
+
   setQuickLinks: function () {
     this.loadTags();
     var serviceName = this.get('content.serviceName');
@@ -88,13 +84,13 @@ App.QuickViewLinks = Em.View.extend({
     var quickLinks = [];
     switch (serviceName) {
       case "HDFS":
-        if ( this.get('content.snameNode')) { // not HA
+        if (this.get('content.snameNode')) { // not HA
           host = App.singleNodeInstall ? App.singleNodeAlias : components.findProperty('componentName',
'NAMENODE').get('host.publicHostName');
         } else {
           // HA
           if (this.get('content.activeNameNode')) {
             host = this.get('content.activeNameNode.publicHostName');
-          }else {
+          } else {
             host = 'noActiveNN';
           }
         }
@@ -137,37 +133,32 @@ App.QuickViewLinks = Em.View.extend({
         }
       ];
     } else {
-    quickLinks = this.get('content.quickLinks').map(function (item) {
-      if (host == 'noActiveNN') {
-        item.set('disabled', true);
-      } else {
-        item.set('disabled', false);
-        var protocol = self.setProtocol(item.get('service_id'));
-        if (item.get('template')) {
-          if(item.get('service_id') === 'YARN'){
-            var port = self.setPort(item.get('service_id'),protocol, version);
-            item.set('url', item.get('template').fmt(protocol,host,port));
-          } else {
-            item.set('url', item.get('template').fmt(protocol,host));
+      quickLinks = this.get('content.quickLinks').map(function (item) {
+        if (host == 'noActiveNN') {
+          item.set('disabled', true);
+        } else {
+          item.set('disabled', false);
+          var protocol = self.setProtocol(item.get('service_id'));
+          if (item.get('template')) {
+            var port = item.get('http_config') && self.setPort(item, protocol, version);
+            item.set('url', item.get('template').fmt(protocol, host, port));
           }
         }
-      }
-      return item;
-    });
+        return item;
+      });
     }
-    this.set('quickLinks',quickLinks);
-  }.observes('App.currentStackVersionNumber', 'App.router.mainAdminSecurityController.securityEnabled'),
+    this.set('quickLinks', quickLinks);
+  }.observes('App.currentStackVersionNumber', 'App.singleNodeInstall'),
 
-  setProtocol: function(service_id){
-    var properties  = this.ambariProperties();
-    var securityProperties = this.get('securityProperties');
+  setProtocol: function (service_id) {
+    var properties = this.ambariProperties();
+    var configProperties = this.get('configProperties');
     var hadoopSslEnabled = false;
-    if(securityProperties) {
-      securityProperties.forEach(function(property){
-        property['hadoop.ssl.enabled'] && property['hadoop.ssl.enabled'] === 'true'
?  hadoopSslEnabled = true : null;
-      });
+    if (configProperties) {
+      var site = configProperties.findProperty('type', 'core-site');
+      site.properties['hadoop.ssl.enabled'] && site.properties['hadoop.ssl.enabled']
=== 'true' ? hadoopSslEnabled = true : null;
     }
-    switch(service_id){
+    switch (service_id) {
       case "GANGLIA":
         return (properties && properties.hasOwnProperty('ganglia.https') &&
properties['ganglia.https']) ? "https" : "http";
         break;
@@ -175,10 +166,30 @@ App.QuickViewLinks = Em.View.extend({
         return (properties && properties.hasOwnProperty('nagios.https') &&
properties['nagios.https']) ? "https" : "http";
         break;
       case "HDFS":
-      case "YARN":
+      case "HBASE":
       case "MAPREDUCE":
+        return hadoopSslEnabled ? "https" : "http";
+        break;
+      case "YARN":
+        var yarnProperties = configProperties.findProperty('type', 'yarn-site');
+        if (yarnProperties && yarnProperties.properties) {
+          if (yarnProperties.properties['yarn.http.policy'] === 'HTTPS_ONLY') {
+            return "https";
+          } else if (yarnProperties.properties['yarn.http.policy'] === 'HTTP_ONLY') {
+            return "http";
+          }
+        }
+        return hadoopSslEnabled ? "https" : "http";
+        break;
       case "MAPREDUCE2":
-      case "HBASE":
+        var mapred2Properties = configProperties.findProperty('type', 'mapred-site');
+        if (mapred2Properties && mapred2Properties.properties) {
+          if (mapred2Properties.properties['mapreduce.jobhistory.http.policy'] === 'HTTPS_ONLY')
{
+            return "https";
+          } else if (mapred2Properties.properties['mapreduce.jobhistory.http.policy'] ===
'HTTP_ONLY') {
+            return "http";
+          }
+        }
         return hadoopSslEnabled ? "https" : "http";
         break;
       default:
@@ -186,12 +197,27 @@ App.QuickViewLinks = Em.View.extend({
     }
   },
 
-  setPort: function(service_id, protocol, version) {
-    var port = '';
-    if (service_id === 'YARN') {
-      port = (protocol === 'https' && stringUtils.compareVersions(version,'2.0.5')
=== 1) ? '8090' : '8088'
+  setPort: function (item, protocol, version) {
+    var service_id = item.get('service_id');
+    var configProperties = this.get('configProperties');
+    var config = item.get('http_config');
+    var defaultPort = item.get('default_http_port');
+    if (protocol === 'https' && item.get('https_config')) {
+      config = item.get('https_config');
+      if (item.get('default_https_port')) {
+        defaultPort = item.get('default_https_port');
+      }
     }
-    return port;
+    var site = configProperties.findProperty('type', item.get('site'));
+    var propertyValue = site && site.properties[config];
+    if (!propertyValue) {
+      return defaultPort;
+    }
+
+    var re = new RegExp(item.get('regex'));
+
+    var portValue = propertyValue.match(re);
+    return  portValue[1];
   },
 
   linkTarget: function () {


Mime
View raw message