Repository: ambari
Updated Branches:
  refs/heads/trunk 7c0bab119 -> c4a553539


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


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

Branch: refs/heads/trunk
Commit: c4a55353955e9fb1538cadf53ca1fe3956092448
Parents: 7c0bab1
Author: aBabiichuk <ababiic...@cybervisiontech.com>
Authored: Thu Aug 7 18:11:36 2014 +0300
Committer: aBabiichuk <ababiic...@cybervisiontech.com>
Committed: Thu Aug 7 18:11:52 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step8_controller.js  | 109 +++++++++----------
 1 file changed, 52 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c4a55353/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js 
b/ambari-web/app/controllers/wizard/step8_controller.js
index e2a2a29..727eee4 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/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;
   },
 

Reply via email to