ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [45/50] [abbrv] ambari git commit: AMBARI-14599: Update hawq configs to remove hawq_standby_address_host on single node clusters (bhuvnesh2703 via jaoki)
Date Fri, 15 Jan 2016 17:34:09 GMT
AMBARI-14599: Update hawq configs to remove hawq_standby_address_host on single node clusters
(bhuvnesh2703 via jaoki)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 665d9e4c3967425564f5a9e39263c28790c5e03f
Parents: 92abe3d
Author: Jun Aoki <jaoki@apache.org>
Authored: Wed Jan 13 16:15:28 2016 -0800
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Thu Jan 14 11:43:29 2016 -0500

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 37 ++++++++++++++------
 .../test/controllers/wizard/step7_test.js       | 35 ++++++++++++++++++
 2 files changed, 61 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/665d9e4c/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 42b5b87..92abe21 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -690,21 +690,36 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
     });
   },
 
+  /**
+   * Update hawq configuration depending on the state of the cluster
+   * @param {Array} configs
+   */
+  updateHawqConfigs: function (configs) {
+    if (this.get('wizardController.name') == 'addServiceController') {
+      if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs);
+      if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs);
+      if (App.get('isKerberosEnabled')) this.addHawqConfigsOnKerberizedCluster(configs);
+    }
+    if (App.get('isSingleNode')) this.removeHawqStandbyHostAddressConfig(configs);
+    return configs
+  },
+
+  /**
+   * Remove hawq_standby_address_host config from HAWQ configs
+   * @param {Array} configs
+   */
+  removeHawqStandbyHostAddressConfig: function(configs) {
+    var hawqStandbyAddressHostIndex = configs.indexOf(configs.findProperty('name', 'hawq_standby_address_host'));
+    if (hawqStandbyAddressHostIndex > -1) configs.removeAt(hawqStandbyAddressHostIndex)
;
+    return configs
+  },
+
   applyServicesConfigs: function (configs) {
     if (this.get('allSelectedServiceNames').contains('YARN')) {
       configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
     }
-    // If HAWQ service is being added, add NN-HA/RM-HA/Kerberos related parameters to hdfs-client/yarn-client
if applicable
-    if (this.get('wizardController.name') == 'addServiceController' && !this.get('installedServiceNames').contains('HAWQ')
&& this.get('allSelectedServiceNames').contains('HAWQ')) {
-      if (App.get('isHaEnabled')) {
-        this.addHawqConfigsOnNnHa(configs);
-      }
-      if (App.get('isRMHaEnabled')) {
-        this.addHawqConfigsOnRMHa(configs);
-      }
-      if (App.get('isKerberosEnabled')) {
-        this.addHawqConfigsOnKerberizedCluster(configs);
-      }
+    if (!this.get('installedServiceNames').contains('HAWQ') && this.get('allSelectedServiceNames').contains('HAWQ'))
{
+      this.updateHawqConfigs(configs);
     }
     if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController')
{
       this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs')
|| []);

http://git-wip-us.apache.org/repos/asf/ambari/blob/665d9e4c/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 2d82cbc..d8c4552 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1165,6 +1165,41 @@ describe('App.InstallerStep7Controller', function () {
         }
       });
     });
+
+  });
+
+  describe('#updateHawqConfigs', function() {
+    var testHawqSiteConfigs = [
+      {
+        name: 'hawq_standby_address_host',
+        value: 'h2'
+      },
+      {
+        name: 'hawq_master_address_host',
+        value: 'h1'
+      }
+    ];
+    var oldHawqSiteLength = testHawqSiteConfigs.length;
+    it('hawq_standby_address_host should be removed on single node cluster', function() {
+      sinon.stub(App, 'get').withArgs('isSingleNode').returns(true);
+      var hawqSiteConfigs = testHawqSiteConfigs.slice();
+      var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs);
+      expect(updatedHawqSiteConfigs.length).to.be.eql(oldHawqSiteLength-1);
+      expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host')).to.be.eql(undefined);
+      expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_master_address_host').value).to.be.eql('h1');
+      App.get.restore()
+    });
+
+    it('hawq_standby_address_host should not be removed on multi node clusters', function()
{
+      sinon.stub(App, 'get').withArgs('isSingleNode').returns(false);
+      var hawqSiteConfigs = testHawqSiteConfigs.slice();
+      var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs);
+      expect(updatedHawqSiteConfigs.length).to.be.eql(oldHawqSiteLength);
+      expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host').value).to.be.eql('h2');
+      expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_master_address_host').value).to.be.eql('h1');
+      App.get.restore();
+    });
+
   });
 
   describe('#_updateIsEditableFlagForConfig', function () {


Mime
View raw message