You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/10/12 14:23:14 UTC

[2/2] ambari git commit: AMBARI-13377. External URL (policymgr_external_ur) value in Ranger service should be recommended by stack advisor. Additional fix (dlysnichenko)

AMBARI-13377. External URL (policymgr_external_ur) value in Ranger service should be recommended by stack advisor. Additional fix (dlysnichenko)


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

Branch: refs/heads/branch-2.1
Commit: 4192bb12e8c1a7b44e4638247ff0ba373dff0d8c
Parents: 565e083
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Oct 12 15:22:29 2015 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Oct 12 15:23:09 2015 +0300

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |  8 +++--
 .../stacks/2.0.6/common/test_stack_advisor.py   | 34 +++++++++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4192bb12/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index b4c662a..9bb21ea 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -271,8 +271,12 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     ranger_admin_host = 'localhost'
     port = '6080'
 
-    if 'ranger-site' in services['configurations'] and 'http.enabled' in services['configurations']['ranger-site']['properties'] \
-      and services['configurations']['ranger-site']['properties']['http.enabled'].lower() == 'false':
+    # Check if http is disabled. For HDP-2.3 this can be checked in ranger-admin-site/ranger.service.http.enabled
+    # For HDP-2.2 this can be checked in ranger-site/http.enabled
+    if ('ranger-site' in services['configurations'] and 'http.enabled' in services['configurations']['ranger-site']['properties'] \
+      and services['configurations']['ranger-site']['properties']['http.enabled'].lower() == 'false') or \
+      ('ranger-admin-site' in services['configurations'] and 'ranger.service.http.enabled' in services['configurations']['ranger-admin-site']['properties'] \
+      and services['configurations']['ranger-admin-site']['properties']['ranger.service.http.enabled'].lower() == 'false'):
       # HTTPS protocol is used
       protocol = 'https'
       # In HDP-2.3 port stored in ranger-admin-site ranger.service.https.port

http://git-wip-us.apache.org/repos/asf/ambari/blob/4192bb12/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index c016951..da70191 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -705,11 +705,7 @@ class TestHDP206StackAdvisor(TestCase):
         "ranger-admin-site": {
           "properties": {
             "ranger.service.http.port": "7777",
-            }
-        },
-        "ranger-site": {
-          "properties": {
-            "http.enabled": "true",
+            "ranger.service.http.enabled": "true",
             }
         }
       }
@@ -726,6 +722,34 @@ class TestHDP206StackAdvisor(TestCase):
     self.stackAdvisor.recommendRangerConfigurations(recommendedConfigurations, clusterData, services, None)
     self.assertEquals(recommendedConfigurations, expected)
 
+    # Recommend for DB_FLAVOR POSTGRES and https enabled, HDP-2.3
+    configurations = {
+      "admin-properties": {
+        "properties": {
+          "DB_FLAVOR": "POSTGRES",
+          }
+      },
+      "ranger-admin-site": {
+        "properties": {
+          "ranger.service.https.port": "7777",
+          "ranger.service.http.enabled": "false",
+          }
+      }
+    }
+    services['configurations'] = configurations
+
+    expected = {
+      "admin-properties": {
+        "properties": {
+          "SQL_CONNECTOR_JAR": "/usr/share/java/postgresql.jar",
+          "policymgr_external_url": "https://host1:7777",
+          }
+      },
+      }
+    recommendedConfigurations = {}
+    self.stackAdvisor.recommendRangerConfigurations(recommendedConfigurations, clusterData, services, None)
+    self.assertEquals(recommendedConfigurations, expected)
+
     # Recommend for DB_FLAVOR ORACLE and https enabled, HDP-2.2
     configurations = {
       "admin-properties": {