Browse Source

AMBARI-6771 Start services failed on SUSE after cluster install. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
c4a5535395
1 changed files with 52 additions and 57 deletions
  1. 52 57
      ambari-web/app/controllers/wizard/step8_controller.js

+ 52 - 57
ambari-web/app/controllers/wizard/step8_controller.js

@@ -233,46 +233,43 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
    */
   removeHiveConfigs: function (configs) {
     var hiveDb = configs.findProperty('name', 'hive_database');
-    var hiveDbType = {name: 'hive_database_type', value: 'mysql'};
-
-    var hive_properties = Em.A([]);
-
-    if (hiveDb.value === 'New MySQL Database') {
-      if (configs.someProperty('name', 'hive_ambari_host')) {
-        configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_ambari_host').value;
-        hiveDbType.value = 'mysql';
-      }
-      hive_properties = Em.A(['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host',
-        'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
-    }
-    else {
-      if (hiveDb.value === 'Existing MySQL Database') {
-        configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_mysql_host').value;
-        hiveDbType.value = 'mysql';
-        hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_oracle_host',
-          'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
-      }
-      else {
-        if (hiveDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql')) {
+    var hiveDbType = configs.findProperty('name', 'hive_database_type');
+    if (hiveDbType) {
+      var hive_properties = Em.A([]);
+
+      switch (hiveDb.value) {
+        case 'New MySQL Database':
+          if (configs.someProperty('name', 'hive_ambari_host')) {
+            configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_ambari_host').value;
+            hiveDbType.value = 'mysql';
+          }
+          hive_properties = Em.A(['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host',
+            'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
+          break;
+        case 'Existing MySQL Database':
+          configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_mysql_host').value;
+          hiveDbType.value = 'mysql';
+          hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_oracle_host',
+            'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
+          break;
+        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
           configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_postgresql_host').value;
           hiveDbType.value = 'postgres';
           hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_oracle_host',
             'hive_existing_oracle_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database']);
-        }
-        else { //existing oracle database
+          break;
+        default:
           configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_oracle_host').value;
           hiveDbType.value = 'oracle';
           hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_mysql_host',
             'hive_existing_mysql_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
-        }
+          break;
       }
-    }
-
-    hive_properties.forEach(function (property) {
-      configs = configs.without(configs.findProperty('name', property));
-    });
 
-    configs.pushObject(hiveDbType);
+      hive_properties.forEach(function (property) {
+        configs = configs.without(configs.findProperty('name', property));
+      });
+    }
     return configs;
   },
 
@@ -284,43 +281,41 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
    */
   removeOozieConfigs: function (configs) {
     var oozieDb = configs.findProperty('name', 'oozie_database');
-    var oozieDbType = {name: 'oozie_database_type'};
-
-    var oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database']);
-
-    if (oozieDb.value === 'New Derby Database') {
-      configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_ambari_host').value;
-      oozieDbType.value = 'derby';
-      oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_mysql_host',
-        'oozie_existing_mysql_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
-        'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
-    }
-    else {
-      if (oozieDb.value === 'Existing MySQL Database') {
-        configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_mysql_host').value;
-        oozieDbType.value = 'mysql';
-        oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_oracle_host',
-          'oozie_existing_oracle_database', 'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
-      }
-      else {
-        if (oozieDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql')) {
+    var oozieDbType = configs.findProperty('name', 'hive_database_type');
+    if (oozieDbType) {
+      var oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database']);
+
+      switch (oozieDb.value) {
+        case 'New Derby Database':
+          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_ambari_host').value;
+          oozieDbType.value = 'derby';
+          oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_mysql_host',
+            'oozie_existing_mysql_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
+            'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
+          break;
+        case 'Existing MySQL Database':
+          configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_mysql_host').value;
+          oozieDbType.value = 'mysql';
+          oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_oracle_host',
+            'oozie_existing_oracle_database', 'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
+          break;
+        case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
           configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_postgresql_host').value;
           oozieDbType.value = 'postgresql';
           oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_oracle_host',
             'oozie_existing_oracle_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database']);
-        }
-        else { // existing oracle database
+          break;
+        default:
           configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_oracle_host').value;
           oozieDbType.value = 'oracle';
           oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_mysql_host',
             'oozie_existing_mysql_database', 'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
-        }
+          break;
       }
+      oozie_properties.forEach(function (property) {
+        configs = configs.without(configs.findProperty('name', property));
+      });
     }
-    oozie_properties.forEach(function (property) {
-      configs = configs.without(configs.findProperty('name', property));
-    });
-    configs.pushObject(oozieDbType);
     return configs;
   },