Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 ea9aaf918 -> c35186726


AMBARI-7747. Add Service Wizard: Storm *.childopts configs doesn't properly 
setup. (Buzhor Denys via onechiporenko)


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

Branch: refs/heads/branch-1.7.0
Commit: c351867269c3e8c164b1e8910b5891c4bb4d12fa
Parents: ea9aaf9
Author: Oleg Nechiporenko <[email protected]>
Authored: Sat Oct 11 18:37:09 2014 +0300
Committer: Oleg Nechiporenko <[email protected]>
Committed: Sat Oct 11 18:37:09 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  | 12 +++++---
 .../test/controllers/wizard/step7_test.js       | 30 +++++++++++++++++++-
 2 files changed, 37 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c3518672/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 103d0ba..c00d743 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -685,10 +685,14 @@ App.WizardStep7Controller = 
Em.Controller.extend(App.ServerValidatorMixin, {
     // if Ganglia selected or installed, set ganglia host to configs
     if (this.get('installedServiceNames').contains('STORM') && 
this.get('installedServiceNames').contains('GANGLIA')) return;
     if (this.get('allSelectedServiceNames').contains('GANGLIA') || 
this.get('installedServiceNames').contains('GANGLIA')) {
-      hosts = this.get('wizardController').getDBProperty('hosts');
-      gangliaHostId = 
this.get('wizardController').getDBProperty('masterComponentHosts').findProperty('component',
 'GANGLIA_SERVER').host_id;
-      for (var hostName in hosts) {
-        if (hosts[hostName].id == gangliaHostId) gangliaServerHost = 
hosts[hostName].name;
+      if (this.get('wizardController.name') === 'addServiceController') {
+        gangliaServerHost = 
this.get('wizardController').getDBProperty('masterComponentHosts').findProperty('component',
 'GANGLIA_SERVER').hostName;
+      } else {
+        hosts = this.get('wizardController').getDBProperty('hosts');
+        gangliaHostId = 
this.get('wizardController').getDBProperty('masterComponentHosts').findProperty('component',
 'GANGLIA_SERVER').host_id;
+        for (var hostName in hosts) {
+          if (hosts[hostName].id == gangliaHostId) gangliaServerHost = 
hosts[hostName].name;
+        }
       }
       dependentConfigs.forEach(function (configName) {
         var config = configs.findProperty('name', configName);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c3518672/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 e47316e..ce07144 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -389,6 +389,34 @@ describe('App.InstallerStep7Controller', function () {
       });
     });
 
+    it('should replace host name for *.childopts properties if Ganglia is in 
installedServiceNames for Add Service Wizard', function () {
+      var installedServiceNames = ['GANGLIA'],
+        configs = [
+          {name: 'nimbus.childopts', value: '.jar=host=host2', defaultValue: 
''},
+          {name: 'supervisor.childopts', value: '.jar=host=host2', 
defaultValue: ''},
+          {name: 'worker.childopts', value: '.jar=host=host2', defaultValue: 
''}
+        ],
+        expected = [
+          {name: 'nimbus.childopts', value: '.jar=host=realhost1', 
defaultValue: '.jar=host=realhost1', forceUpdate: true},
+          {name: 'supervisor.childopts', value: '.jar=host=realhost1', 
defaultValue: '.jar=host=realhost1', forceUpdate: true},
+          {name: 'worker.childopts', value: '.jar=host=realhost1', 
defaultValue: '.jar=host=realhost1', forceUpdate: true}
+        ];
+      installerStep7Controller.reopen({
+        installedServiceNames: installedServiceNames,
+        wizardController: Em.Object.create({
+          name: 'addServiceController',
+          masterComponentHosts: [{component: 'GANGLIA_SERVER', hostName: 
'realhost1'}],
+          getDBProperty: function (k) {
+            return this.get(k);
+          }
+        })
+      });
+      installerStep7Controller.resolveStormConfigs(configs);
+      Em.keys(expected[0]).forEach(function (k) {
+        expect(configs.mapProperty(k)).to.eql(expected.mapProperty(k));
+      });
+    });
+
   });
 
   describe('#resolveServiceDependencyConfigs', function () {
@@ -1151,4 +1179,4 @@ describe('App.InstallerStep7Controller', function () {
 
   });
 
-});
\ No newline at end of file
+});

Reply via email to