Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 ce74cce71 -> 5fabacc88


AMBARI-19400 Reconfigure after adding/deleting ZooKeeper Server is not 
performed if Atlas is installed. (ababiichuk)


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

Branch: refs/heads/branch-2.5
Commit: 5fabacc884daa34de1a764a90de7a855644a5288
Parents: ce74cce
Author: ababiichuk <[email protected]>
Authored: Fri Jan 6 12:41:38 2017 +0200
Committer: ababiichuk <[email protected]>
Committed: Fri Jan 6 12:41:38 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 157 +++++++------------
 .../test/controllers/main/host/details_test.js  |  10 +-
 2 files changed, 70 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5fabacc8/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js 
b/ambari-web/app/controllers/main/host/details.js
index 3d2ede2..f040db5 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -67,6 +67,44 @@ App.MainHostDetailsController = 
Em.Controller.extend(App.SupportClientConfigsDow
    */
   isOozieServerAddable: true,
 
+  zooKeeperRelatedServices: [
+    {
+      serviceName: 'HIVE',
+      typesToLoad: ['hive-site', 'webhcat-site'],
+      typesToSave: ['hive-site', 'webhcat-site']
+    },
+    {
+      serviceName: 'YARN',
+      typesToLoad: ['yarn-site', 'zoo.cfg'],
+      typesToSave: ['yarn-site']
+    },
+    {
+      serviceName: 'HBASE',
+      typesToLoad: ['hbase-site'],
+      typesToSave: ['hbase-site']
+    },
+    {
+      serviceName: 'ACCUMULO',
+      typesToLoad: ['accumulo-site'],
+      typesToSave: ['accumulo-site']
+    },
+    {
+      serviceName: 'KAFKA',
+      typesToLoad: ['kafka-broker'],
+      typesToSave: ['kafka-broker']
+    },
+    {
+      serviceName: 'ATLAS',
+      typesToLoad: ['application-properties', 'infra-solr-env'],
+      typesToSave: ['application-properties']
+    },
+    {
+      serviceName: 'STORM',
+      typesToLoad: ['storm-site'],
+      typesToSave: ['storm-site']
+    }
+  ],
+
   /**
    * Open dashboard page
    * @method routeHome
@@ -1352,30 +1390,15 @@ App.MainHostDetailsController = 
Em.Controller.extend(App.SupportClientConfigsDow
     if (App.get('isHaEnabled')) {
       urlParams.push('(type=core-site&tag=' + 
data.Clusters.desired_configs['core-site'].tag + ')');
     }
-    if (services.someProperty('serviceName', 'HBASE')) {
-      urlParams.push('(type=hbase-site&tag=' + 
data.Clusters.desired_configs['hbase-site'].tag + ')');
-    }
-    if (services.someProperty('serviceName', 'HIVE')) {
-      urlParams.push('(type=webhcat-site&tag=' + 
data.Clusters.desired_configs['webhcat-site'].tag + ')');
-      urlParams.push('(type=hive-site&tag=' + 
data.Clusters.desired_configs['hive-site'].tag + ')');
-    }
-    if (services.someProperty('serviceName', 'STORM')) {
-      urlParams.push('(type=storm-site&tag=' + 
data.Clusters.desired_configs['storm-site'].tag + ')');
-    }
-    if (services.someProperty('serviceName', 'YARN')) {
-      urlParams.push('(type=yarn-site&tag=' + 
data.Clusters.desired_configs['yarn-site'].tag + ')');
-      urlParams.push('(type=zoo.cfg&tag=' + 
data.Clusters.desired_configs['zoo.cfg'].tag + ')');
-    }
-    if (services.someProperty('serviceName', 'ACCUMULO')) {
-      urlParams.push('(type=accumulo-site&tag=' + 
data.Clusters.desired_configs['accumulo-site'].tag + ')');
-    }
-    if (services.someProperty('serviceName', 'KAFKA')) {
-      urlParams.push('(type=kafka-broker&tag=' + 
data.Clusters.desired_configs['kafka-broker'].tag + ')');
-    }
-    if (services.someProperty('serviceName', 'ATLAS')) {
-      urlParams.push('(type=application-properties&tag=' + 
data.Clusters.desired_configs['application-properties'].tag + ')');
-      urlParams.push('(type=infra-solr-env&tag=' + 
data.Clusters.desired_configs['infra-solr-env'].tag + ')');
-    }
+    this.get('zooKeeperRelatedServices').forEach(function (service) {
+      if (services.someProperty('serviceName', service.serviceName)) {
+        service.typesToLoad.forEach(function (type) {
+          if (data.Clusters.desired_configs[type]) {
+            urlParams.push('(type=' + type + '&tag=' + 
data.Clusters.desired_configs[type].tag + ')');
+          }
+        });
+      }
+    });
     return urlParams;
   },
 
@@ -1393,79 +1416,21 @@ App.MainHostDetailsController = 
Em.Controller.extend(App.SupportClientConfigsDow
     }, this);
 
     this.updateZkConfigs(configs);
-    var groups = [
-      {
-        properties: {
-          'hive-site': configs['hive-site'],
-          'webhcat-site': configs['webhcat-site']
-        },
-        properties_attributes: {
-          'hive-site': attributes['hive-site'],
-          'webhcat-site': attributes['webhcat-site']
-        }
-      }
-    ];
+    var groups = [];
     var installedServiceNames = App.Service.find().mapProperty('serviceName');
-    if (installedServiceNames.contains('YARN')) {
-      groups.push(
-        {
-          properties: {
-            'yarn-site': configs['yarn-site']
-          },
-          properties_attributes: {
-            'yarn-site': attributes['yarn-site']
-          }
-        }
-      );
-    }
-    if (installedServiceNames.contains('HBASE')) {
-      groups.push(
-        {
-          properties: {
-            'hbase-site': configs['hbase-site']
-          },
-          properties_attributes: {
-            'hbase-site': attributes['hbase-site']
-          }
-        }
-      );
-    }
-    if (installedServiceNames.contains('ACCUMULO')) {
-      groups.push(
-        {
-          properties: {
-            'accumulo-site': configs['accumulo-site']
-          },
-          properties_attributes: {
-            'accumulo-site': attributes['accumulo-site']
-          }
-        }
-      );
-    }
-    if (installedServiceNames.contains('KAFKA')) {
-      groups.push(
-        {
-          properties: {
-            'kafka-broker': configs['kafka-broker']
-          },
-          properties_attributes: {
-            'kafka-broker': attributes['kafka-broker']
-          }
-        }
-      );
-    }
-    if (installedServiceNames.contains('ATLAS')) {
-      groups.push(
-        {
-          properties: {
-            'application-properties': configs['application-properties']
-          },
-          properties_attributes: {
-            'application-properties': attributes['application-properties']
-          }
-        }
-      );
-    }
+    this.get('zooKeeperRelatedServices').forEach(function (service) {
+      if (installedServiceNames.contains(service.serviceName)) {
+        var group = {
+          properties: {},
+          properties_attributes: {}
+        };
+        service.typesToSave.forEach(function (type) {
+          group.properties[type] = configs[type];
+          group.properties_attributes[type] = attributes[type];
+        });
+        groups.push(group);
+      }
+    });
     this.saveConfigsBatch(groups, 'ZOOKEEPER_SERVER');
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5fabacc8/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js 
b/ambari-web/test/controllers/main/host/details_test.js
index 88f5395..90f47cf 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -935,6 +935,9 @@ describe('App.MainHostDetailsController', function () {
           },
           'accumulo-site': {
             tag: 1
+          },
+          'application-properties': {
+            tag: 1
           }
         }
       }
@@ -969,7 +972,7 @@ describe('App.MainHostDetailsController', function () {
 
     it('HIVE is installed', function () {
       loadService('HIVE');
-      
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=webhcat-site&tag=1)',
 '(type=hive-site&tag=1)']);
+      
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=hive-site&tag=1)',
 '(type=webhcat-site&tag=1)']);
     });
 
     it('STORM is installed', function () {
@@ -986,6 +989,11 @@ describe('App.MainHostDetailsController', function () {
       loadService('ACCUMULO');
       
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=accumulo-site&tag=1)']);
     });
+
+    it('ATLAS is installed, AMBARI_INFRA isn\'t installed', function () {
+      loadService('ATLAS');
+      
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=application-properties&tag=1)']);
+    });
   });
 
   describe('#loadConfigsSuccessCallback()', function () {

Reply via email to