You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/05/05 07:03:27 UTC

ambari git commit: AMBARI-10907. Implement Database connectivity check from Ranger admin host (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 326d5928c -> 2bcbf2db0


AMBARI-10907. Implement Database connectivity check from Ranger admin host (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 2bcbf2db012215bb23126cf19386102d7ae4625c
Parents: 326d592
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue May 5 08:03:19 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue May 5 08:03:19 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/data/HDP2.3/site_properties.js   | 276 ++++++++++++++++++-
 .../app/utils/configs/config_property_helper.js |  13 +-
 ambari-web/app/views/common/controls_view.js    | 197 +++++++++----
 .../test/views/common/controls_view_test.js     | 123 ++++++++-
 4 files changed, 549 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2bcbf2db/ambari-web/app/data/HDP2.3/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.3/site_properties.js b/ambari-web/app/data/HDP2.3/site_properties.js
index 90f2aba..e9cab0f 100644
--- a/ambari-web/app/data/HDP2.3/site_properties.js
+++ b/ambari-web/app/data/HDP2.3/site_properties.js
@@ -21,44 +21,302 @@ var App = require('app');
 var hdp22properties = require('data/HDP2.2/site_properties').configProperties;
 
 var excludedConfigs = [
-    'DB_FLAVOR'
+  'DB_FLAVOR',
+  'db_host',
+  'SQL_COMMAND_INVOKER',
+  'db_name',
+  'db_root_user',
+  'db_root_password'
 ];
 
 var hdp23properties = hdp22properties.filter(function (item) {
   return !excludedConfigs.contains(item.name);
 });
 
-hdp23properties.push(
-  {
+hdp23properties.push({
     "id": "site property",
     "name": "DB_FLAVOR",
     "displayName": "DB FLAVOR",
-    "value": "MYSQL",
-    "defaultValue": "MYSQL",
+    "value": "",
+    "defaultValue": "",
     "isReconfigurable": true,
     "options": [
       {
-        displayName: 'MYSQL'
+        displayName: 'MYSQL',
+        foreignKeys: ['ranger_mysql_database', 'ranger_mysql_host']
       },
       {
-        displayName: 'ORACLE'
+        displayName: 'ORACLE',
+        foreignKeys: ['ranger_oracle_database', 'ranger_oracle_host']
       },
       {
-        displayName: 'POSTGRES'
+        displayName: 'POSTGRES',
+        foreignKeys: ['ranger_postgres_database', 'ranger_postgres_host']
       },
       {
-        displayName: 'SQLSERVER'
+        displayName: 'MSSQL',
+        foreignKeys: ['ranger_mssql_database', 'ranger_mssql_host']
       }
     ],
     "displayType": "radio button",
     "radioName": "RANGER DB_FLAVOR",
     "isOverridable": false,
     "isVisible": true,
+    "isObserved": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 0
+  },
+  {
+    "name": "ranger_mysql_database",
+    "id": "puppet var",
+    "displayName": "Database Type",
+    "value": "",
+    "defaultValue": "MySQL",
+    "description": "Using a MySQL database for Ranger",
+    "displayType": "masterHost",
+    "isOverridable": false,
+    "isVisible": false,
+    "isReconfigurable": false,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 1
+  },
+  {
+    "name": "ranger_oracle_database",
+    "id": "puppet var",
+    "displayName": "Database Type",
+    "value": "",
+    "defaultValue": "ORACLE",
+    "description": "Using an Oracle database for Ranger",
+    "displayType": "masterHost",
+    "isOverridable": false,
+    "isVisible": false,
+    "isReconfigurable": false,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 2
+  },
+  {
+    "name": "ranger_postgres_database",
+    "id": "puppet var",
+    "displayName": "Database Type",
+    "value": "",
+    "defaultValue": "Postgres",
+    "description": "Using a Postgres database for Ranger",
+    "displayType": "masterHost",
+    "isOverridable": false,
+    "isVisible": false,
+    "isReconfigurable": false,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 3
+  },
+  {
+    "name": "ranger_mssql_database",
+    "id": "puppet var",
+    "displayName": "Database Type",
+    "value": "",
+    "defaultValue": "MSSQL",
+    "description": "Using a MS SQL database for Ranger",
+    "displayType": "masterHost",
+    "isOverridable": false,
+    "isVisible": false,
+    "isReconfigurable": false,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 4
+  },
+  {
+    "name": "rangerserver_host",
+    "id": "puppet var",
+    "displayName": "Ranger Server host",
+    "value": "",
+    "defaultValue": "",
+    "description": "The host that has been assigned to run Ranger Server",
+    "displayType": "masterHost",
+    "isOverridable": false,
+    "isVisible": true,
+    "isRequiredByAgent": false,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 0
+  },
+  {
+    "name": "db_host",
+    "id": "site property",
+    "displayName": "Ranger DB host",
+    "defaultValue": "",
+    "isObserved": true,
+    "isReconfigurable": true,
+    "displayType": "masterHost",
+    "isOverridable": false,
+    "isVisible": false,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings"
   },
   {
+    "name": "ranger_mysql_host",
+    "id": "puppet var",
+    "displayName": "MYSQL database Host",
+    "description": "Specify the host on which the existing database is hosted",
+    "defaultValue": "",
+    "value": "",
+    "displayType": "host",
+    "isOverridable": false,
+    "isVisible": false,
+    "isObserved": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 6
+  },
+  {
+    "name": "ranger_oracle_host",
+    "id": "puppet var",
+    "displayName": "Oracle database Host",
+    "description": "Specify the host on which the existing database is hosted",
+    "defaultValue": "",
+    "value": "",
+    "displayType": "host",
+    "isOverridable": false,
+    "isVisible": false,
+    "isObserved": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 7
+  },
+  {
+    "name": "ranger_postgres_host",
+    "id": "puppet var",
+    "displayName": "Database Host",
+    "description": "Specify the host on which the existing database is hosted",
+    "defaultValue": "",
+    "value": "",
+    "displayType": "host",
+    "isOverridable": false,
+    "isVisible": false,
+    "isObserved": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 8
+  },
+  {
+    "name": "ranger_mssql_host",
+    "id": "puppet var",
+    "displayName": "Database Host",
+    "description": "Specify the host on which the existing database is hosted",
+    "defaultValue": "",
+    "value": "",
+    "displayType": "host",
+    "isOverridable": false,
+    "isVisible": false,
+    "isObserved": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 9
+  },
+  {
+    "name": "SQL_COMMAND_INVOKER",
+    "id": "site property",
+    "displayName": "SQL Command Invoker",
+    "defaultValue": "mysql",
+    "isObserved": true,
+    "isReconfigurable": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 10
+  },
+  {
+    "name": "ranger_jdbc_connection_url",
+    "id": "site property",
+    "displayName": "JDBC connect string for a Ranger database",
+    "defaultValue": "",
+    "isReconfigurable": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isObserved": true,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 11
+  },
+  {
+    "name": "ranger_jdbc_driver",
+    "id": "site property",
+    "displayName": "Driver class name for a JDBC Ranger database",
+    "defaultValue": "",
+    "isReconfigurable": true,
+    "isObserved": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 12
+  },
+  {
+    "name": "db_root_user",
+    "id": "site property",
+    "displayName": "Ranger DB root user",
+    "defaultValue": "",
+    "isReconfigurable": true,
+    "isObserved": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 13
+  },
+  {
+    "name": "db_root_password",
+    "id": "site property",
+    "displayName": "Ranger DB root password",
+    "defaultValue": "",
+    "isReconfigurable": true,
+    "isObserved": true,
+    "displayType": "password",
+    "isOverridable": false,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 14
+  },
+  {
+    "name": "db_name",
+    "id": "site property",
+    "displayName": "Ranger DB name",
+    "defaultValue": "",
+    "isReconfigurable": true,
+    "isObserved": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "DBSettings",
+    "index": 15
+  },
+  {
     "id": "site property",
     "name": "tez.am.view-acls",
     "displayName": "tez.am.view-acls",

http://git-wip-us.apache.org/repos/asf/ambari/blob/2bcbf2db/ambari-web/app/utils/configs/config_property_helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_property_helper.js b/ambari-web/app/utils/configs/config_property_helper.js
index 333214c..07e3340 100644
--- a/ambari-web/app/utils/configs/config_property_helper.js
+++ b/ambari-web/app/utils/configs/config_property_helper.js
@@ -316,6 +316,17 @@ module.exports = {
           configProperty.set('isRequired', 'false');
         }
         break;
+      case 'db_host':
+      case 'rangerserver_host':
+        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN').hostName);
+        break;
+      case 'ranger_mysql_host':
+      case 'ranger_oracle_host':
+      case 'ranger_postgres_host':
+      case 'ranger_mssql_host':
+        var rangerServerHost = masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN').hostName;
+        configProperty.set('value', rangerServerHost).set('defaultValue', rangerServerHost);
+        break;
     }
   },
 
@@ -554,4 +565,4 @@ module.exports = {
       configProperty.set('defaultValue', mPoint);
     }
   }
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/2bcbf2db/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 6dcea19..641445a 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -417,7 +417,7 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     // on page render, automatically populate JDBC URLs only for default database settings
     // so as to not lose the user's customizations on these fields
     if (['addServiceController', 'installerController'].contains(this.get('controller.wizardController.name'))) {
-      if (/^New\s\w+\sDatabase$/.test(this.get('serviceConfig.value')) || this.dontUseHandleDbConnection.contains(this.get('serviceConfig.name'))) {
+      if (/^New\s\w+\sDatabase$/.test(this.get('serviceConfig.value')) || this.get('dontUseHandleDbConnection').contains(this.get('serviceConfig.name'))) {
         this.onOptionsChange();
       } else {
         if (App.get('isHadoopWindowsStack') && /SQL\sauthentication/.test(this.get('serviceConfig.value'))) {
@@ -429,9 +429,19 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
   },
 
   /**
-   * properties with these names don'use handleDBConnectionProperty mathod
+   * properties with these names don'use handleDBConnectionProperty method
    */
-  dontUseHandleDbConnection: ['DB_FLAVOR', 'authentication_method'],
+  dontUseHandleDbConnection: function () {
+    var version = App.get('currentStackVersion').match(/(\d+)[\.,]?(\d+)?/),
+      majorVersion = version?version[1]: 0,
+      minorVersion = version? version[2]: 0;
+    // functionality added in HDP 2.3
+    // remove DB_FLAVOR so it can handle DB Connection checks
+    if (App.get('currentStackName') == 'HDP' && majorVersion >= 2  && minorVersion>= 3) {
+      return ['authentication_method'];
+    }
+    return ['DB_FLAVOR', 'authentication_method'];
+  }.property(),
 
   configs: function () {
     if (this.get('controller.name') == 'mainServiceInfoConfigsController') return this.get('categoryConfigsAll');
@@ -559,6 +569,50 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
               isRequired: isNotExistingMySQLServer
             });
             break;
+          case 'RANGER':
+            var mysqlUrl = 'jdbc:mysql://{0}/{1}',
+              sqlCommand = 'mysql',
+              sqlConnectorJARValue = '/usr/share/java/mysql-connector-java.jar',
+              sqlCommandInvoker = categoryConfigsAll.findProperty('name','SQL_COMMAND_INVOKER'),
+              sqlConnectorJAR = this.get('parentView.serviceConfigs').findProperty('name', 'SQL_CONNECTOR_JAR'),
+              dbFlavor = this.get('serviceConfig.value'),
+              databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
+              currentDBFlavor = dbFlavor.match(databasesTypes).length?dbFlavor.match(databasesTypes)[0]:'';
+
+            switch (currentDBFlavor.toUpperCase()) {
+              case 'ORACLE':
+                connectionUrlValue = oracleUrl.format(hostName, databaseName);
+                connectionUrlDefaultValue = oracleUrl.format(hostNameDefault, databaseNameDefault);
+                dbClassValue = 'oracle.jdbc.driver.OracleDriver';
+                sqlCommand = 'sqlplus';
+                sqlConnectorJARValue = '/usr/share/java/ojdbc6.jar';
+                break;
+              case 'MYSQL':
+                connectionUrlValue = mysqlUrl.format(hostName, databaseName);
+                connectionUrlDefaultValue = mysqlUrl.format(hostNameDefault, databaseNameDefault);
+                dbClassValue = 'com.mysql.jdbc.Driver';
+                sqlConnectorJARValue = '/usr/share/java/mysql-connector-java.jar';
+                break;
+              case 'POSTGRES':
+                connectionUrlValue = postgresUrl.format(hostName, databaseName);
+                connectionUrlDefaultValue = postgresUrl.format(hostNameDefault, databaseNameDefault);
+                dbClassValue = 'org.postgresql.Driver';
+                sqlCommand = 'psql';
+                sqlConnectorJARValue = '/usr/share/java/postgresql.jar';
+                break;
+              case 'MSSQL':
+                connectionUrlValue = mssqlUrl.format(hostName, databaseName);
+                connectionUrlDefaultValue = mssqlUrl.format(hostNameDefault, databaseNameDefault);
+                dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
+                sqlCommand = 'sqlcmd';
+                sqlConnectorJARValue = '/usr/share/java/sqljdbc4.jar';
+                break;
+            }
+            this.get('categoryConfigsAll').findProperty('name', 'db_host').set('value', this.get('hostNameProperty.value'));
+            sqlConnectorJAR.set('value',sqlConnectorJARValue);
+            sqlConnectorJAR.set('defaultValue',sqlConnectorJARValue);
+            sqlCommandInvoker.set('value', sqlCommand);
+            break;
         }
         connectionUrl.set('value', connectionUrlValue);
         connectionUrl.set('defaultValue', connectionUrlDefaultValue);
@@ -570,14 +624,14 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
   nameBinding: 'serviceConfig.radioName',
 
   databaseNameProperty: function () {
-    switch (this.get('serviceConfig.serviceName')) {
-      case 'HIVE':
-        return this.get('categoryConfigsAll').findProperty('name', 'ambari.hive.db.schema.name');
-      case 'OOZIE':
-        return this.get('categoryConfigsAll').findProperty('name', 'oozie.db.schema.name');
-      default:
-        return null;
-    }
+    var databaseNameConfig = {
+      'HIVE': 'ambari.hive.db.schema.name',
+      'OOZIE':'oozie.db.schema.name',
+      'RANGER': 'db_name'
+    };
+    return Object.keys(databaseNameConfig).contains(this.get('serviceConfig.serviceName'))?
+      this.get('categoryConfigsAll').findProperty('name', databaseNameConfig[this.get('serviceConfig.serviceName')]):
+      null;
   }.property('serviceConfig.serviceName'),
 
   databaseName: function () {
@@ -642,6 +696,33 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
       } else {
         returnValue = this.get('categoryConfigsAll').findProperty('name', 'oozie_hostname');
       }
+    } else if (this.get('serviceConfig.serviceName') === 'RANGER') {
+      if (value) {
+        var databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
+          currentDBFlavor = value.match(databasesTypes),
+          dbHost = this.get('categoryConfigsAll').findProperty('name', 'db_host'),
+          hostnameConfig = {
+            'MYSQL': 'ranger_mysql_host',
+            'ORACLE': 'ranger_oracle_host',
+            'POSTGRES': 'ranger_postgres_host',
+            'MSSQL': 'ranger_mssql_host'
+          };
+        if (currentDBFlavor) {
+          hostname = this.get('categoryConfigsAll').findProperty('name', hostnameConfig[currentDBFlavor[0].toUpperCase()]);
+        }
+        if (hostname) {
+          if (!hostname.value) {
+            hostname.set('value', this.get('categoryConfigsAll').findProperty('name', 'db_host').get('value'));
+          }
+          Em.set(hostname, 'isUserProperty', false);
+          if (dbHost) {
+            dbHost.set('value', hostname.value);
+          }
+          returnValue = hostname;
+        } else {
+          returnValue = this.get('categoryConfigsAll').findProperty('name', 'db_host');
+        }
+      }
     }
     return returnValue;
   }.property('serviceConfig.serviceName', 'serviceConfig.value'),
@@ -651,19 +732,21 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
   }.property('hostNameProperty.value'),
 
   connectionUrl: function () {
-    if (this.get('serviceConfig.serviceName') === 'HIVE') {
-      return this.get('categoryConfigsAll').findProperty('name', 'javax.jdo.option.ConnectionURL');
-    } else {
-      return this.get('categoryConfigsAll').findProperty('name', 'oozie.service.JPAService.jdbc.url');
-    }
+    var connectionUrlConfig = {
+      'HIVE': 'javax.jdo.option.ConnectionURL',
+      'OOZIE':'oozie.service.JPAService.jdbc.url',
+      'RANGER': 'ranger_jdbc_connection_url'
+    };
+    return this.get('categoryConfigsAll').findProperty('name', connectionUrlConfig[this.get('serviceConfig.serviceName')]);
   }.property('serviceConfig.serviceName'),
 
   dbClass: function () {
-    if (this.get('serviceConfig.serviceName') === 'HIVE') {
-      return this.get('categoryConfigsAll').findProperty('name', 'javax.jdo.option.ConnectionDriverName');
-    } else {
-      return this.get('categoryConfigsAll').findProperty('name', 'oozie.service.JPAService.jdbc.driver');
-    }
+    var dbClassConfig = {
+      'HIVE': 'javax.jdo.option.ConnectionDriverName',
+      'OOZIE':'oozie.service.JPAService.jdbc.driver',
+      'RANGER': 'ranger_jdbc_driver'
+    };
+    return this.get('categoryConfigsAll').findProperty('name', dbClassConfig[this.get('serviceConfig.serviceName')]);
   }.property('serviceConfig.serviceName'),
 
   /**
@@ -675,30 +758,36 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
    * @method handleDBConnectionProperty
    **/
   handleDBConnectionProperty: function() {
-    if (this.dontUseHandleDbConnection.contains(this.get('serviceConfig.name')))
+    if (this.get('dontUseHandleDbConnection').contains(this.get('serviceConfig.name'))) {
       return;
-    var handledProperties = ['oozie_database', 'hive_database'];
+    }
+    var handledProperties = ['oozie_database', 'hive_database', 'DB_FLAVOR'];
     var currentValue = this.get('serviceConfig.value');
-    var databases = /MySQL|PostgreSQL|Oracle|Derby|MSSQL/gi;
+    var databases = /MySQL|PostgreSQL|Postgres|Oracle|Derby|MSSQL/gi;
     var currentDB = currentValue.match(databases)[0];
-    var databasesTypes = /MySQL|PostgreS|Oracle|Derby|MSSQL/gi;
+    var databasesTypes = /MySQL|Postgres|Oracle|Derby|MSSQL/gi;
     var currentDBType = currentValue.match(databasesTypes)[0];
-    var existingDatabase = /existing/gi.test(currentValue);
+    var checkDatabase = /existing/gi.test(currentValue);
     // db connection check button show up if existed db selected
     var propertyAppendTo1 = this.get('categoryConfigsAll').findProperty('displayName', 'Database URL');
-    if (currentDB && existingDatabase) {
-      if (handledProperties.contains(this.get('serviceConfig.name'))) {
-        if (propertyAppendTo1) propertyAppendTo1.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
-      }
-    } else {
-      propertyAppendTo1.set('additionalView', null);
-    }
     // warning msg under database type radio buttons, to warn the user to setup jdbc driver if existed db selected
     var propertyHive = this.get('categoryConfigsAll').findProperty('displayName', 'Hive Database');
     var propertyOozie = this.get('categoryConfigsAll').findProperty('displayName', 'Oozie Database');
     var propertyAppendTo2 = propertyHive ? propertyHive : propertyOozie;
-    if (currentDB && existingDatabase) {
+    // RANGER specific
+    if (this.get('serviceConfig.serviceName') === 'RANGER') {
+      propertyAppendTo1 = this.get('categoryConfigsAll').findProperty('name', 'db_name');
+      propertyAppendTo2 = this.get('categoryConfigsAll').findProperty('name', 'DB_FLAVOR');
+      // check for all db types when installing Ranger - not only for existing ones
+      checkDatabase = true;
+    }
+    propertyAppendTo1.set('additionalView', null);
+    propertyAppendTo2.set('additionalView', null);
+    if (currentDB && checkDatabase) {
       if (handledProperties.contains(this.get('serviceConfig.name'))) {
+        if (propertyAppendTo1) {
+          propertyAppendTo1.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
+        }
         if (propertyAppendTo2) {
           propertyAppendTo2.set('additionalView', Ember.View.extend({
             template: Ember.Handlebars.compile('<div class="alert">{{{view.message}}}</div>'),
@@ -707,6 +796,7 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
         }
       }
     } else {
+      propertyAppendTo1.set('additionalView', null);
       propertyAppendTo2.set('additionalView', null);
     }
   }.observes('serviceConfig.value'),
@@ -1101,6 +1191,8 @@ App.CheckDBConnectionView = Ember.View.extend({
       return this.get('parentView.service.serviceName').toLowerCase() + '_hostname';
     } else if (this.get('parentView.service.serviceName') === 'KERBEROS') {
       return 'kdc_host';
+    } else if (this.get('parentView.service.serviceName') === 'RANGER') {
+      return '{0}_{1}_host'.format(this.get('parentView.service.serviceName').toLowerCase(), this.get('databaseName').toLowerCase());
     }
     return '{0}_existing_{1}_host'.format(this.get('parentView.service.serviceName').toLowerCase(), this.get('databaseName').toLowerCase());
   }.property('databaseName'),
@@ -1111,20 +1203,21 @@ App.CheckDBConnectionView = Ember.View.extend({
   /** @property {object} requiredProperties - properties that necessary for database connection **/
   requiredProperties: function() {
     var propertiesMap = {
-      OOZIE: ['oozie.db.schema.name','oozie.service.JPAService.jdbc.username','oozie.service.JPAService.jdbc.password','oozie.service.JPAService.jdbc.driver','oozie.service.JPAService.jdbc.url'],
-      HIVE: ['ambari.hive.db.schema.name','javax.jdo.option.ConnectionUserName','javax.jdo.option.ConnectionPassword','javax.jdo.option.ConnectionDriverName','javax.jdo.option.ConnectionURL'],
-      KERBEROS: ['kdc_host']
+      OOZIE: ['oozie.db.schema.name', 'oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password', 'oozie.service.JPAService.jdbc.driver', 'oozie.service.JPAService.jdbc.url'],
+      HIVE: ['ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword', 'javax.jdo.option.ConnectionDriverName', 'javax.jdo.option.ConnectionURL'],
+      KERBEROS: ['kdc_host'],
+      RANGER: ['db_root_user', 'db_root_password', 'db_name', 'ranger_jdbc_connection_url', 'ranger_jdbc_driver']
     };
     return propertiesMap[this.get('parentView.service.serviceName')];
   }.property(),
   /** @property {Object} propertiesPattern - check pattern according to type of connection properties **/
   propertiesPattern: function() {
     var patterns = {
-      db_connection_url: /jdbc\.url|connectionurl|kdc_host/ig
+      db_connection_url: /jdbc\.url|connection_url|connectionurl|kdc_host/ig
     };
     if (this.get('parentView.service.serviceName') != "KERBEROS") {
-      patterns.user_name = /(username|dblogin)$/ig;
-      patterns.user_passwd = /(dbpassword|password)$/ig;
+      patterns.user_name = /(username|dblogin|root_user)$/ig;
+      patterns.user_passwd = /(dbpassword|password|root_password)$/ig;
     }
     return patterns;
   }.property('parentView.service.serviceName'),
@@ -1134,7 +1227,8 @@ App.CheckDBConnectionView = Ember.View.extend({
       'OOZIE': 'oozie_ambari_host',
       'HDFS': 'hadoop_host',
       'HIVE': 'hive_ambari_host',
-      'KERBEROS': 'kdc_host'
+      'KERBEROS': 'kdc_host',
+      'RANGER': 'rangerserver_host'
     };
     return this.get('parentView.categoryConfigsAll').findProperty('name', serviceMasterMap[this.get('parentView.service.serviceName')]).get('value');
   }.property('parentView.service.serviceName', 'parentView.categoryConfigsAll.@each.value'),
@@ -1144,6 +1238,17 @@ App.CheckDBConnectionView = Ember.View.extend({
     for (var key in this.get('propertiesPattern')) {
       propObj[key] = this.getConnectionProperty(this.get('propertiesPattern')[key]);
     }
+
+    if (this.get('parentView.service.serviceName') === 'RANGER') {
+      var dbFlavor = this.get('parentView.categoryConfigsAll').findProperty('name','DB_FLAVOR').get('value'),
+        databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
+        dbType = dbFlavor.match(databasesTypes)?dbFlavor.match(databasesTypes)[0].toLowerCase():'';
+
+      if (dbType==='oracle') {
+        // fixes oracle SYSDBA issue
+        propObj['user_name'] = "\'%@ as sysdba\'".fmt(propObj['user_name']);
+      }
+    }
     return propObj;
   }.property('parentView.categoryConfigsAll.@each.value'),
   /**
@@ -1170,7 +1275,7 @@ App.CheckDBConnectionView = Ember.View.extend({
         content: Em.I18n.t('installer.controls.checkConnection.popover').format(name),
         placement: 'right',
         trigger: 'hover'
-    });
+      });
     }
     this.handlePropertiesValidation();
     this.getAmbariProperties();
@@ -1197,10 +1302,10 @@ App.CheckDBConnectionView = Ember.View.extend({
     this.set('isValidationPassed', isValid);
   }.observes('parentView.categoryConfigsAll.@each.isValid', 'parentView.categoryConfigsAll.@each.value', 'databaseName'),
 
-  getConnectionProperty: function(regexp, isGetName) {
-    var _this = this;
-    var propertyName = _this.get('requiredProperties').filter(function(item) {
-      return regexp.test(item);
+   getConnectionProperty: function(regexp, isGetName) {
+   var _this = this;
+      var propertyName = _this.get('requiredProperties').filter(function(item) {
+    return regexp.test(item);
     })[0];
     return (isGetName) ? propertyName : _this.get('parentView.categoryConfigsAll').findProperty('name', propertyName).get('value');
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/2bcbf2db/ambari-web/test/views/common/controls_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/controls_view_test.js b/ambari-web/test/views/common/controls_view_test.js
index 00b641e..463edb9 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -103,6 +103,10 @@ describe('App.ServiceConfigRadioButtons', function () {
           },
           {
             name: 'oozie.db.schema.name',
+            value: 'db1'
+          },
+          {
+            name: 'db_name',
             value: 'db2'
           }
         ]
@@ -114,6 +118,10 @@ describe('App.ServiceConfigRadioButtons', function () {
         },
         {
           serviceName: 'OOZIE',
+          value: 'db1'
+        },
+        {
+          serviceName: 'RANGER',
           value: 'db2'
         }
       ];
@@ -194,7 +202,25 @@ describe('App.ServiceConfigRadioButtons', function () {
           {
             name: 'oozie_hostname',
             value: 'h16'
-          }
+          },
+          {
+            name: 'ranger_mysql_host',
+            value: 'h17'
+          },
+          {
+            name: 'ranger_oracle_host',
+            value: 'h18'
+          },
+          {
+            name: 'ranger_postgres_host',
+            value: 'h19'
+          },
+          {
+            name: 'ranger_mssql_host',
+            value: 'h20'
+          },
+
+
         ]
       }),
       cases = [
@@ -267,6 +293,26 @@ describe('App.ServiceConfigRadioButtons', function () {
           serviceName: 'OOZIE',
           value: 'default case',
           expected: 'h16'
+        },
+        {
+          serviceName: 'RANGER',
+          value: 'MYSQL',
+          expected: 'h17'
+        },
+        {
+          serviceName: 'RANGER',
+          value: 'ORACLE',
+          expected: 'h18'
+        },
+        {
+          serviceName: 'RANGER',
+          value: 'POSTGRES',
+          expected: 'h19'
+        },
+        {
+          serviceName: 'RANGER',
+          value: 'MSSQL',
+          expected: 'h20'
         }
       ];
 
@@ -313,6 +359,12 @@ describe('App.ServiceConfigRadioButtons', function () {
           }),
           Em.Object.create({
             name: 'oozie.service.JPAService.jdbc.password'
+          }),
+          Em.Object.create({
+            name: 'db_host'
+          }),
+          Em.Object.create({
+            name: 'SQL_COMMAND_INVOKER'
           })
         ],
         parentView: Em.Object.create({
@@ -320,7 +372,11 @@ describe('App.ServiceConfigRadioButtons', function () {
             {
               name: 'hive_database_type',
               value: null
-            }
+            },
+            Em.Object.create({
+              name: 'SQL_CONNECTOR_JAR',
+              value: null
+            })
           ]
         }),
         configs: [{}]
@@ -475,11 +531,62 @@ describe('App.ServiceConfigRadioButtons', function () {
           connectionUrlDefaultValue: 'jdbc:sqlserver://h11;databaseName=db11;integratedSecurity=true',
           dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
           isAuthVisibleAndRequired: false
+        },
+
+
+        {
+          serviceName: 'RANGER',
+          serviceConfigValue: 'MYSQL',
+          databaseName: 'db12',
+          hostName: 'h12',
+          databaseNameDefault: 'db12d',
+          hostNameDefault: 'h12d',
+          connectionUrlValue: 'jdbc:mysql://h12/db12',
+          connectionUrlDefaultValue: 'jdbc:mysql://h12/db12',
+          dbClassValue: 'com.mysql.jdbc.Driver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'RANGER',
+          serviceConfigValue: 'ORACLE',
+          databaseName: 'db13',
+          hostName: 'h13',
+          databaseNameDefault: 'db13d',
+          hostNameDefault: 'h13d',
+          connectionUrlValue: 'jdbc:oracle:thin:@//h13:1521/db13',
+          connectionUrlDefaultValue: 'jdbc:oracle:thin:@//h13:1521/db13',
+          dbClassValue: 'oracle.jdbc.driver.OracleDriver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'RANGER',
+          serviceConfigValue: 'POSTGRES',
+          databaseName: 'db14',
+          hostName: 'h14',
+          databaseNameDefault: 'db14d',
+          hostNameDefault: 'h14d',
+          connectionUrlValue: 'jdbc:postgresql://h14:5432/db14',
+          connectionUrlDefaultValue: 'jdbc:postgresql://h14:5432/db14',
+          dbClassValue: 'org.postgresql.Driver',
+          isAuthVisibleAndRequired: true
+        },
+        {
+          serviceName: 'RANGER',
+          serviceConfigValue: 'MSSQL',
+          databaseName: 'db15',
+          hostName: 'h15',
+          databaseNameDefault: 'db15d',
+          hostNameDefault: 'h15d',
+          connectionUrlValue: 'jdbc:sqlserver://h15;databaseName=db15',
+          connectionUrlDefaultValue: 'jdbc:sqlserver://h15;databaseName=db15',
+          dbClassValue: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
+          isAuthVisibleAndRequired: true
         }
       ],
       serviceAuthPropsMap = {
         HIVE: ['javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword'],
-        OOZIE: ['oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password']
+        OOZIE: ['oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password'],
+        RANGER: []
       };
 
     beforeEach(function () {
@@ -621,6 +728,10 @@ describe('App.CheckDBConnectionView', function () {
         {
           serviceName: 'HIVE',
           value: 'h2'
+        },
+        {
+          serviceName: 'RANGER',
+          value: 'h3'
         }
       ],
       categoryConfigsAll = [
@@ -635,6 +746,10 @@ describe('App.CheckDBConnectionView', function () {
         Em.Object.create({
           name: 'hive_ambari_host',
           value: 'h2'
+        }),
+        Em.Object.create({
+          name: 'rangerserver_host',
+          value: 'h3'
         })
       ];
 
@@ -696,4 +811,4 @@ describe('App.BaseUrlTextField', function () {
 
   });
 
-});
\ No newline at end of file
+});