Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 0035ed370 -> 132c2fd87


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/132c2fd8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/132c2fd8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/132c2fd8

Branch: refs/heads/branch-2.2
Commit: 132c2fd8760e8baccf16add50f3dbed4e735b0d2
Parents: 0035ed3
Author: Jun Aoki <ja...@apache.org>
Authored: Wed Jan 13 16:16:40 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Wed Jan 13 16:16:40 2016 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 31 ++++++++++++++------
 .../test/controllers/wizard/step7_test.js       | 22 ++++++++++++++
 2 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/132c2fd8/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 cf54e06..4c3dfde 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -699,22 +699,35 @@ App.WizardStep7Controller = 
Em.Controller.extend(App.ServerValidatorMixin, App.E
     });
   },
 
+  /**
+   * 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, storedConfigs) {
     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('wizardController.name') == 'addServiceController') {
+      if (!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 (App.get('isSingleNode')) 
this.removeHawqStandbyHostAddressConfig(configs);
     var dependedServices = ["STORM", "YARN"];
     dependedServices.forEach(function (serviceName) {
       if (this.get('allSelectedServiceNames').contains(serviceName)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/132c2fd8/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 4c00437..50a55e6 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -2130,6 +2130,28 @@ describe('App.InstallerStep7Controller', function () {
     });
   });
 
+  describe('#removeHawqStandbyAddressHostConfig', 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', function() {
+      var hawqSiteConfigs = testHawqSiteConfigs.slice();
+      var updatedHawqSiteConfigs = 
installerStep7Controller.removeHawqStandbyHostAddressConfig(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');
+    });
+
+  });
+
   describe('#errorsCount', function () {
 
     it('should ignore configs with widgets (enhanced configs)', function () {

Reply via email to