ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-13329. Test connection button for Ranger privileged user should not connect to ranger database. (jaimin)
Date Wed, 07 Oct 2015 01:12:41 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0d676b323 -> 828c7fa8a


AMBARI-13329. Test connection button for Ranger privileged user should not connect to ranger
database. (jaimin)


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

Branch: refs/heads/trunk
Commit: 828c7fa8a818b4b7e8d83b4d2c470894cac0c714
Parents: 0d676b3
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Tue Oct 6 18:11:42 2015 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Tue Oct 6 18:12:32 2015 -0700

----------------------------------------------------------------------
 .../RANGER/configuration/ranger-env.xml         | 20 ++++++
 .../HDP/2.3/services/RANGER/themes/theme.json   | 64 +++++++++-----------
 .../stacks/HDP/2.3/services/stack_advisor.py    | 21 ++++++-
 3 files changed, 68 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/828c7fa8/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
index a8ad1b6..5ed7b22 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-env.xml
@@ -75,5 +75,25 @@
     </value-attributes>
   </property>
 
+  <property>
+    <name>ranger_privelege_user_jdbc_url</name>
+    <display-name>JDBC connect string for root user</display-name>
+    <description>JDBC connect string - auto populated based on other values. This is
to be used by root user</description>
+    <value>jdbc:mysql://localhost</value>
+    <value-attributes>
+      <overridable>false</overridable>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>admin-properties</type>
+        <name>DB_FLAVOR</name>
+      </property>
+      <property>
+        <type>admin-properties</type>
+        <name>db_host</name>
+      </property>
+    </depends-on>
+  </property>
+
 
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/828c7fa8/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme.json
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme.json
index c4f7d59..31d5cf7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme.json
@@ -18,10 +18,10 @@
                   "display-name": "Ranger Admin",
                   "row-index": "0",
                   "column-index": "0",
-                  "row-span": "4",
+                  "row-span": "3",
                   "column-span": "2",
                   "section-columns": "2",
-                  "section-rows": "4",
+                  "section-rows": "3",
                   "subsections": [
                     {
                       "name": "subsection-ranger-db-row1-col1",
@@ -38,30 +38,15 @@
                       "column-span": "1"
                     },
                     {
-                      "name": "subsection-ranger-db-row2-col1",
+                      "name": "subsection-ranger-db-row2",
                       "row-index": "1",
                       "column-index": "0",
                       "row-span": "1",
-                      "column-span": "1"
-                    },
-                    {
-                      "name": "subsection-ranger-db-row2-col2",
-                      "row-index": "1",
-                      "column-index": "1",
-                      "row-span": "1",
-                      "column-span": "1",
-                      "left-vertical-splitter": false
-                    },
-                    {
-                      "name": "subsection-ranger-db-row3",
-                      "row-index": "2",
-                      "column-index": "0",
-                      "row-span": "1",
                       "column-span": "2"
                     },
                     {
-                      "name": "subsection-ranger-db-row4-col1",
-                      "row-index": "3",
+                      "name": "subsection-ranger-db-row3-col1",
+                      "row-index": "2",
                       "column-index": "0",
                       "row-span": "1",
                       "column-span": "1",
@@ -85,8 +70,8 @@
                       ]
                     },
                     {
-                      "name": "subsection-ranger-db-row4-col2",
-                      "row-index": "3",
+                      "name": "subsection-ranger-db-row3-col2",
+                      "row-index": "2",
                       "column-index": "1",
                       "row-span": "1",
                       "column-span": "1",
@@ -107,8 +92,7 @@
                             }
                           }
                         }
-                      ],
-                      "left-vertical-splitter": false
+                      ]
                     }
                   ]
                 }
@@ -252,6 +236,10 @@
           "subsection-name": "subsection-ranger-db-row1-col1"
         },
         {
+          "config": "admin-properties/db_user",
+          "subsection-name": "subsection-ranger-db-row1-col1"
+        },
+        {
           "config": "ranger-admin-site/ranger.jpa.jdbc.url",
           "subsection-name": "subsection-ranger-db-row1-col1"
         },
@@ -264,16 +252,12 @@
           "subsection-name": "subsection-ranger-db-row1-col2"
         },
         {
-          "config": "admin-properties/db_user",
-          "subsection-name": "subsection-ranger-db-row2-col1"
-        },
-        {
           "config": "admin-properties/db_password",
-          "subsection-name": "subsection-ranger-db-row2-col2"
+          "subsection-name": "subsection-ranger-db-row1-col2"
         },
         {
           "config": "ranger-env/test_db_connection",
-          "subsection-name": "subsection-ranger-db-row2-col2",
+          "subsection-name": "subsection-ranger-db-row2",
           "property_value_attributes": {
             "ui_only_property": true
           },
@@ -298,19 +282,23 @@
         },
         {
           "config": "ranger-env/create_db_dbuser",
-          "subsection-name": "subsection-ranger-db-row3"
+          "subsection-name": "subsection-ranger-db-row2"
         },
         {
           "config": "admin-properties/db_root_user",
-          "subsection-name": "subsection-ranger-db-row4-col1"
+          "subsection-name": "subsection-ranger-db-row3-col1"
+        },
+        {
+          "config": "ranger-env/ranger_privelege_user_jdbc_url",
+          "subsection-name": "subsection-ranger-db-row3-col1"
         },
         {
           "config": "admin-properties/db_root_password",
-          "subsection-name": "subsection-ranger-db-row4-col2"
+          "subsection-name": "subsection-ranger-db-row3-col2"
         },
         {
           "config": "ranger-env/test_root_db_connection",
-          "subsection-name": "subsection-ranger-db-row4-col2",
+          "subsection-name": "subsection-ranger-db-row3-col1",
           "property_value_attributes": {
             "ui_only_property": true
           }
@@ -827,6 +815,12 @@
         }
       },
       {
+        "config": "ranger-env/ranger_privelege_user_jdbc_url",
+        "widget": {
+          "type": "text-field"
+        }
+      },
+      {
         "config": "admin-properties/db_root_user",
         "widget": {
           "type": "text-field"
@@ -845,7 +839,7 @@
           "display-name": "Test Connection",
           "required-properties": {
             "jdbc.driver.class": "ranger-admin-site/ranger.jpa.jdbc.driver",
-            "jdbc.driver.url": "ranger-admin-site/ranger.jpa.jdbc.url",
+            "jdbc.driver.url": "ranger-env/ranger_privelege_user_jdbc_url",
             "db.connection.source.host": "ranger-site/ranger_admin_hosts",
             "db.type": "admin-properties/DB_FLAVOR",
             "db.connection.destination.host": "admin-properties/db_host",

http://git-wip-us.apache.org/repos/asf/ambari/blob/828c7fa8/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index adb6689..51a514e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -255,6 +255,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
   def recommendRangerConfigurations(self, configurations, clusterData, services, hosts):
     super(HDP23StackAdvisor, self).recommendRangerConfigurations(configurations, clusterData,
services, hosts)
     putRangerAdminProperty = self.putProperty(configurations, "ranger-admin-site", services)
+    putRangerEnvProperty = self.putProperty(configurations, "ranger-env", services)
 
     if 'admin-properties' in services['configurations'] and ('DB_FLAVOR' in services['configurations']['admin-properties']['properties'])\
       and ('db_host' in services['configurations']['admin-properties']['properties']) and
('db_name' in services['configurations']['admin-properties']['properties']):
@@ -262,17 +263,33 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
       rangerDbFlavor = services['configurations']["admin-properties"]["properties"]["DB_FLAVOR"]
       rangerDbHost =   services['configurations']["admin-properties"]["properties"]["db_host"]
       rangerDbName =   services['configurations']["admin-properties"]["properties"]["db_name"]
-      ranger_db_driver_dict = {
+      ranger_db_url_dict = {
         'MYSQL': {'ranger.jpa.jdbc.driver': 'com.mysql.jdbc.Driver', 'ranger.jpa.jdbc.url':
'jdbc:mysql://' + rangerDbHost + '/' + rangerDbName},
         'ORACLE': {'ranger.jpa.jdbc.driver': 'oracle.jdbc.driver.OracleDriver', 'ranger.jpa.jdbc.url':
'jdbc:oracle:thin:@/' + rangerDbHost + ':1521/' + rangerDbName},
         'POSTGRES': {'ranger.jpa.jdbc.driver': 'org.postgresql.Driver', 'ranger.jpa.jdbc.url':
'jdbc:postgresql://' + rangerDbHost + ':5432/' + rangerDbName},
         'MSSQL': {'ranger.jpa.jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
'ranger.jpa.jdbc.url': 'jdbc:sqlserver://' + rangerDbHost + ';databaseName=' + rangerDbName},
         'SQLA': {'ranger.jpa.jdbc.driver': 'sap.jdbc4.sqlanywhere.IDriver', 'ranger.jpa.jdbc.url':
'jdbc:sqlanywhere:host=' + rangerDbHost + ';database=' + rangerDbName}
       }
-      rangerDbProperties = ranger_db_driver_dict.get(rangerDbFlavor, ranger_db_driver_dict['MYSQL'])
+      rangerDbProperties = ranger_db_url_dict.get(rangerDbFlavor, ranger_db_url_dict['MYSQL'])
       for key in rangerDbProperties:
         putRangerAdminProperty(key, rangerDbProperties.get(key))
 
+      if 'admin-properties' in services['configurations'] and ('DB_FLAVOR' in services['configurations']['admin-properties']['properties'])
\
+        and ('db_host' in services['configurations']['admin-properties']['properties']):
+
+        rangerDbFlavor = services['configurations']["admin-properties"]["properties"]["DB_FLAVOR"]
+        rangerDbHost =   services['configurations']["admin-properties"]["properties"]["db_host"]
+        ranger_db_privelege_url_dict = {
+          'MYSQL': {'ranger_privelege_user_jdbc_url': 'jdbc:mysql://' + rangerDbHost},
+          'ORACLE': {'ranger_privelege_user_jdbc_url': 'jdbc:oracle:thin:@/' + rangerDbHost
+ ':1521'},
+          'POSTGRES': {'ranger_privelege_user_jdbc_url': 'jdbc:postgresql://' + rangerDbHost
+ ':5432'},
+          'MSSQL': {'ranger_privelege_user_jdbc_url': 'jdbc:sqlserver://' + rangerDbHost
+ ';'},
+          'SQLA': {'ranger_privelege_user_jdbc_url': 'jdbc:sqlanywhere:host=' + rangerDbHost
+ ';'}
+        }
+        rangerPrivelegeDbProperties = ranger_db_privelege_url_dict.get(rangerDbFlavor, ranger_db_privelege_url_dict['MYSQL'])
+        for key in rangerPrivelegeDbProperties:
+          putRangerEnvProperty(key, rangerPrivelegeDbProperties.get(key))
+
   def getServiceConfigurationValidators(self):
       parentValidators = super(HDP23StackAdvisor, self).getServiceConfigurationValidators()
       childValidators = {


Mime
View raw message