ソースを参照

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

Alex Antonenko 10 年 前
コミット
2fb314f7d1

+ 9 - 3
ambari-web/app/utils/configs/config_property_helper.js

@@ -318,14 +318,20 @@ module.exports = {
         break;
       case 'db_host':
       case 'rangerserver_host':
-        configProperty.set('value', masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN').hostName);
+        var masterComponent =  masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN');
+        if (masterComponent) {
+          configProperty.set('value', masterComponent.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);
+        var masterComponent = masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN'),
+          rangerServerHost = masterComponent ? masterComponentHostsInDB.findProperty('component', 'RANGER_ADMIN').hostName : '';
+        if (rangerServerHost) {
+          configProperty.set('value', rangerServerHost).set('defaultValue', rangerServerHost);
+        }
         break;
     }
   },

+ 3 - 1
ambari-web/app/views/common/controls_view.js

@@ -419,7 +419,9 @@ 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.get('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.get('serviceConfig.serviceName') === 'RANGER') {
         this.onOptionsChange();
       } else {
         if (App.get('isHadoopWindowsStack') && /SQL\sauthentication/.test(this.get('serviceConfig.value'))) {