You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/07/13 15:02:07 UTC

git commit: AMBARI-6472. Add Service Wizard corrupts the zookeeper config for existing Storm service (Buzhor Denys via alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 b527f3bb5 -> 7ba362a48


AMBARI-6472. Add Service Wizard corrupts the zookeeper config for existing Storm service (Buzhor Denys via alexantonenko)


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

Branch: refs/heads/branch-1.6.1
Commit: 7ba362a485863d129c5f1d2efb8434bc5b23e0c6
Parents: b527f3b
Author: Alex Antonenko <hi...@gmail.com>
Authored: Sun Jul 13 16:01:34 2014 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Sun Jul 13 16:01:34 2014 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    |  6 ++++-
 .../app/controllers/wizard/step8_controller.js  | 24 ++++++++------------
 2 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7ba362a4/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index c985389..4b887ad 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -1679,7 +1679,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   setServerConfigValue: function (configName, value) {
     switch (configName) {
       case 'storm.zookeeper.servers':
-        return JSON.stringify(value).replace(/"/g, "'");
+        if( Object.prototype.toString.call( value ) === '[object Array]' ) {
+          return JSON.stringify(value).replace(/"/g, "'");
+        } else {
+          return value;
+        }
         break;
       case 'content':
         return value;

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ba362a4/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index e6f54ad..9985c5d 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -825,23 +825,21 @@ App.WizardStep8Controller = Em.Controller.extend({
    * @method updateConfigurations
    */
   updateConfigurations: function (configsToUpdate) {
+    var configurationController = App.router.get('mainServiceInfoConfigsController');
     var configs = configsToUpdate.filter(function(config) {
       return !!config.filename && !/^(global|core)/.test(config.filename);
     });
-    var fileNames = configs.mapProperty('filename').uniq();
+    var serviceNames = configs.mapProperty('serviceName').uniq();
     var configsMap = [];
-    fileNames.forEach(function(fileName) {
-      var properties = {};
-      var tagVersion = 'version' + (new Date).getTime();
-      configs.filterProperty('filename', fileName).forEach(function(config) {
-        properties[config.name] = config.value;
-      });
-      configsMap.push({
-        type: fileName.replace('.xml',''),
-        tag: tagVersion,
-        properties: properties
+
+    serviceNames.forEach(function (serviceName) {
+      var serviceConfigs = configs.filterProperty('serviceName', serviceName);
+      var tagName = 'version' + (new Date).getTime();
+      serviceConfigs.mapProperty('filename').uniq().forEach(function (siteName) {
+        configsMap.push(configurationController.createSiteObj(siteName.replace(".xml", ""), tagName, serviceConfigs.filterProperty('filename', siteName)));
       });
     });
+
     if (!configsMap.length) return;
     var configData = configsMap.map(function (_serviceConfig) {
       return JSON.stringify({
@@ -911,7 +909,7 @@ App.WizardStep8Controller = Em.Controller.extend({
     this.createCluster();
     this.createSelectedServices();
     if (this.get('content.controllerName') !== 'addHostController') {
-      if (this.get('wizardController').getDBProperty('configsToUpdate')) {
+      if (this.get('wizardController').getDBProperty('configsToUpdate') && this.get('wizardController').getDBProperty('configsToUpdate').length) {
         this.updateConfigurations(this.get('wizardController').getDBProperty('configsToUpdate'));
       }
       this.createConfigurations();
@@ -1356,8 +1354,6 @@ App.WizardStep8Controller = Em.Controller.extend({
       globalSiteObj.tag = tag;
       coreSiteObject.tag = tag;
       this.get('serviceConfigTags').pushObject(coreSiteObject);
-      //for Add Service save config of new and installed services either
-      selectedServices = selectedServices.concat(this.get('installedServices'));
     }
     this.get('serviceConfigTags').pushObject(globalSiteObj);