AMBARI-12423. Ambari - Deleting a Zookeeper server doesn't update the the 
storm.zookeeper.servers property for Storm (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 6172fb8634887bba485beb7ebb2f7ff54d55e702
Parents: b1add6e
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Tue Jul 21 08:57:05 2015 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Tue Jul 21 12:57:35 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 36 ++++++++++++++++----
 .../test/controllers/main/host/details_test.js  |  2 +-
 2 files changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6172fb86/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 2413ae2..8f97044 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -340,6 +340,7 @@ App.MainHostDetailsController = Em.Controller.extend({
     this.removeHostComponentModel(data.componentName, data.hostName);
     if (data.componentName == 'ZOOKEEPER_SERVER') {
       this.set('fromDeleteZkServer', true);
+      this.updateStormConfigs();
       this.loadConfigs();
     } else if (data.componentName == 'HIVE_METASTORE') {
       this.set('deleteHiveMetaStore', true);
@@ -681,6 +682,19 @@ App.MainHostDetailsController = Em.Controller.extend({
   },
 
   /**
+   * Update zk configs
+   * @param {object} configs
+   * @method updateZkConfigs
+   */
+  updateZkConfigs: function(configs) {
+    var zks = this.getZkServerHosts();
+    var portValue = configs['zoo.cfg'] && Em.get(configs['zoo.cfg'], 
'clientPort');
+    var zkPort = typeof portValue === 'udefined' ? '2181' : portValue;
+    var zksWithPort = this.concatZkNames(zks, zkPort);
+    this.setZKConfigs(configs, zksWithPort, zks);
+  },
+
+  /**
    * update and save Storm related configs to server
    * @param {object} data
    * @method onLoadStormConfigs
@@ -696,6 +710,8 @@ App.MainHostDetailsController = Em.Controller.extend({
       attributes[item.type] = item.properties_attributes || {};
     }, this);
 
+    this.updateZkConfigs(configs);
+
     configs['storm-site']['nimbus.seeds'] = 
JSON.stringify(stormNimbusHosts).replace(/"/g, "'");
     var groups = [
       {
@@ -1001,6 +1017,16 @@ App.MainHostDetailsController = Em.Controller.extend({
     this.showBackgroundOperationsPopup();
   },
 
+   /**
+   * Update storm config
+   * @method updateStormConfigs
+   */
+  updateStormConfigs: function() {
+    if (App.Service.find().findProperty('serviceName', 'STORM')) {
+      this.loadConfigs("loadStormConfigs");
+    }
+  },
+
   /**
    * Load tags
    * @method checkZkConfigs
@@ -1011,6 +1037,7 @@ App.MainHostDetailsController = Em.Controller.extend({
       var self = this;
       
this.removeObserver('App.router.backgroundOperationsController.serviceTimestamp',
 this, this.checkZkConfigs);
       setTimeout(function () {
+        self.updateStormConfigs();
         self.loadConfigs();
       }, App.get('componentsUpdateInterval'));
     }
@@ -1099,11 +1126,8 @@ App.MainHostDetailsController = Em.Controller.extend({
       attributes[item.type] = item.properties_attributes || {};
     }, this);
 
-    var zks = this.getZkServerHosts();
-    var portValue = configs['zoo.cfg'] && Em.get(configs['zoo.cfg'], 
'clientPort');
-    var zkPort = typeof portValue === 'udefined' ? '2181' : portValue;
-    var zksWithPort = this.concatZkNames(zks, zkPort);
-    this.setZKConfigs(configs, zksWithPort, zks);
+    this.updateZkConfigs(configs);
+
     var groups = [
       {
         properties: {
@@ -1840,7 +1864,7 @@ App.MainHostDetailsController = Em.Controller.extend({
       nonDeletableComponents: [],
       unknownComponents: [],
       toDecommissionComponents: []
-    }; 
+    };
     var self = this;
     if (componentsOnHost && componentsOnHost.get('length') > 0) {
       componentsOnHost.forEach(function (cInstance) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6172fb86/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 c01b6df..1345803 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -1037,7 +1037,7 @@ describe('App.MainHostDetailsController', function () {
       var popup = controller.installComponent(event);
       expect(App.ModalPopup.show.calledOnce).to.be.true;
       popup.onPrimary();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(App.ajax.send.called).to.be.true;
     });
   });
 

Reply via email to