ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject ambari git commit: AMBARI-12773-3. Ranger quick link in Ambari 2.1.0 with HDP-2.2 does not track the http, https port value.(xiwang)
Date Fri, 21 Aug 2015 23:06:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 d81b0f97d -> c551775c7


AMBARI-12773-3. Ranger quick link in Ambari 2.1.0 with HDP-2.2 does not track the http, https
port value.(xiwang)


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

Branch: refs/heads/branch-2.1
Commit: c551775c773deb662833c1d41c8fba7e0992d73d
Parents: d81b0f9
Author: Xi Wang <xiwang@apache.org>
Authored: Fri Aug 21 13:58:02 2015 -0700
Committer: Xi Wang <xiwang@apache.org>
Committed: Fri Aug 21 16:06:08 2015 -0700

----------------------------------------------------------------------
 .../app/views/common/quick_view_link_view.js    | 31 +++++++++++++++---
 .../test/views/common/quick_link_view_test.js   | 34 +++++++++++++++++++-
 2 files changed, 60 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c551775c/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 e76127e..8eb8d7c 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -75,7 +75,7 @@ App.QuickViewLinks = Em.View.extend({
   /**
    * list of files that contains properties for enabling/disabling ssl
    */
-  requiredSiteNames: ['hadoop-env','yarn-env','hbase-env','oozie-env','mapred-env','storm-env',
'falcon-env', 'core-site', 'hdfs-site', 'hbase-site', 'oozie-site', 'yarn-site', 'mapred-site',
'storm-site', 'spark-defaults', 'accumulo-site', 'application-properties', 'ranger-site'],
+  requiredSiteNames: ['hadoop-env','yarn-env','hbase-env','oozie-env','mapred-env','storm-env',
'falcon-env', 'core-site', 'hdfs-site', 'hbase-site', 'oozie-site', 'yarn-site', 'mapred-site',
'storm-site', 'spark-defaults', 'accumulo-site', 'application-properties', 'ranger-admin-site',
'ranger-site'],
   /**
    * Get public host name by its host name.
    *
@@ -381,8 +381,20 @@ App.QuickViewLinks = Em.View.extend({
         return "http";
         break;
       case "RANGER":
-        var rangerProperties = configProperties && configProperties.findProperty('type',
'ranger-site');
-        if (rangerProperties && rangerProperties.properties && rangerProperties.properties['HTTP_ENABLED']
== "false") {
+        var rangerProperties = configProperties && configProperties.findProperty('type',
'ranger-admin-site');
+        var rangerSiteProperties = configProperties && configProperties.findProperty('type',
'ranger-site');
+        if (rangerProperties && rangerProperties.properties &&
+          rangerProperties.properties['ranger.service.https.attrib.ssl.enabled'] == "true"
&&
+          rangerProperties.properties['ranger.service.http.enabled'] == "false") {
+          //HDP2.3
+          return "https";
+        } else if (rangerProperties && rangerProperties.properties &&
+          rangerProperties.properties['ranger.service.https.attrib.ssl.enabled'] == "false"
&&
+          rangerProperties.properties['ranger.service.http.enabled'] == "true") {
+          //HDP2.3
+          return "http";
+        } else if (rangerSiteProperties && rangerSiteProperties.properties &&
rangerSiteProperties.properties['http.enabled'] == "false") {
+          //HDP2.2
           return "https";
         } else {
           return "http";
@@ -413,11 +425,22 @@ App.QuickViewLinks = Em.View.extend({
     var site = configProperties.findProperty('type', item.get('site'));
     var propertyValue = site && site.properties && site.properties[config];
     if (!propertyValue) {
+      if (item.get('service_id') == 'RANGER') {
+        // HDP 2.3
+        var adminSite = configProperties.findProperty('type', 'ranger-admin-site');
+        if (protocol === 'https') {
+          propertyValue = adminSite && adminSite.properties && adminSite.properties['ranger.service.https.port'];
+        } else {
+          propertyValue = adminSite && adminSite.properties && adminSite.properties['ranger.service.http.port'];
+        }
+      }
+    }
+
+    if (!propertyValue) {
       return defaultPort;
     }
 
     var re = new RegExp(item.get('regex'));
-
     var portValue = propertyValue.match(re);
     return  portValue[1];
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/c551775c/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
index f9e9941..13dce99 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -48,7 +48,19 @@ describe('App.QuickViewLinks', function () {
       ], m: "http for mapreduce2", result: "http" },
       { serviceName: "ANYSERVICE", configProperties: [
         { type: 'hdfs-site', properties: { 'dfs.http.policy': 'HTTPS_ONLY' }}
-      ], m: "https for anyservice", servicesSupportsHttps: ["ANYSERVICE"], result: "https"
}
+      ], m: "https for anyservice", servicesSupportsHttps: ["ANYSERVICE"], result: "https"
},
+      { serviceName: "RANGER", configProperties: [
+        { type: 'ranger-site', properties: { 'http.enabled': 'true' }}
+      ], m: "http for ranger (HDP2.2)", result: "http" },
+      { serviceName: "RANGER", configProperties: [
+        { type: 'ranger-site', properties: { 'http.enabled': 'false' }}
+      ], m: "https for ranger (HDP2.2)", result: "https" },
+      { serviceName: "RANGER", configProperties: [
+        { type: 'ranger-admin-site', properties: { 'ranger.service.http.enabled': 'true',
'ranger.service.https.attrib.ssl.enabled': 'false'}}
+      ], m: "http for ranger (HDP2.3)", result: "http" },
+      { serviceName: "RANGER", configProperties: [
+        { type: 'ranger-admin-site', properties: { 'ranger.service.http.enabled': 'false',
'ranger.service.https.attrib.ssl.enabled': 'true'}}
+      ], m: "https for ranger (HDP2.3)", result: "https" }
     ];
 
     tests.forEach(function(t) {
@@ -86,6 +98,26 @@ describe('App.QuickViewLinks', function () {
         'default_http_port': '8088',
         'default_https_port': '8090',
         'regex': '\\w*:(\\d+)'
+      }),
+      Em.Object.create({
+        'service_id': 'RANGER',
+        'protocol': 'http',
+        'http_config': 'http_config',
+        'https_config': 'https_config',
+        'result': '6080',
+        'default_http_port': '6080',
+        'default_https_port': '6182',
+        'regex': '(\\d*)+'
+      }),
+      Em.Object.create({
+        'service_id': 'RANGER',
+        'protocol': 'https',
+        'http_config': 'http_config',
+        'https_config': 'https_config',
+        'result': '6182',
+        'default_http_port': '6080',
+        'default_https_port': '6182',
+        'regex': '(\\d*)+'
       })
     ];
 


Mime
View raw message