Updated Branches:
  refs/heads/trunk 0c51fe15e -> 029c1df7d

AMBARI-3889 Post config groups to server on Deploy. (atkach)


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

Branch: refs/heads/trunk
Commit: 029c1df7d12bc573df802ce13ef9991bbc4f1497
Parents: 0c51fe1
Author: atkach <[email protected]>
Authored: Tue Nov 26 19:52:56 2013 +0200
Committer: atkach <[email protected]>
Committed: Tue Nov 26 19:52:56 2013 +0200

----------------------------------------------------------------------
 .../service/manage_config_groups_controller.js  |  3 +-
 ambari-web/app/controllers/wizard.js            |  3 +-
 .../app/controllers/wizard/step7_controller.js  |  1 +
 .../app/controllers/wizard/step8_controller.js  | 40 ++++++++++++++++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/029c1df7/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js 
b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index 5014267..782752f 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -604,7 +604,8 @@ App.InstallerManageConfigGroupsController = 
App.ManageConfigGroupsController.ext
           parentConfigGroup: defaultConfigGroup,
           service: Em.Object.create({id: self.get('serviceName')}),
           hosts: [],
-          configSiteTags: []
+          configSiteTags: [],
+          properties: []
         });
         self.get('loadedHostsToGroupMap')[newConfigGroupData.get('name')] = [];
         self.get('configGroups').pushObject(newConfigGroupData);

http://git-wip-us.apache.org/repos/asf/ambari/blob/029c1df7/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js 
b/ambari-web/app/controllers/wizard.js
index 63a17c1..de04286 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -741,7 +741,8 @@ App.WizardController = Em.Controller.extend({
         configGroup.get('properties').forEach(function (property) {
           properties.push({
             name: property.get('name'),
-            value: property.get('value')
+            value: property.get('value'),
+            filename: property.get('filename')
           })
         });
         //configGroup copied into plain JS object to avoid Converting circular 
structure to JSON

http://git-wip-us.apache.org/repos/asf/ambari/blob/029c1df7/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 93c91f1..5dbd492 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -215,6 +215,7 @@ App.WizardStep7Controller = Em.Controller.extend({
         this.set('overrideToAdd', null);
       }
       configOverrides.setEach('isEditable', !selectedGroup.get('isDefault'));
+      configOverrides.setEach('parentSCP', config);
       config.set('overrides', configOverrides);
     }, this);
   }.observes('selectedConfigGroup'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/029c1df7/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 ca17bb2..1fbdc89 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -884,6 +884,9 @@ App.WizardStep8Controller = Em.Controller.extend({
     this.createConfigurations();
     this.createComponents();
     this.registerHostsToCluster();
+    if (App.supports.hostOverridesInstaller) {
+      this.createConfigurationGroups();
+    }
     this.createAllHostComponents();
     this.createHostOverrideConfigurations();
 
@@ -1389,6 +1392,43 @@ App.WizardStep8Controller = Em.Controller.extend({
     });
   },
 
+  createConfigurationGroups: function () {
+    var configGroups = 
this.get('content.configGroups').filterProperty('isDefault', false);
+    var clusterName = this.get('clusterName');
+    var sendData = [];
+    var serviceConfigController = 
App.router.get('mainServiceInfoConfigsController');
+    configGroups.forEach(function (configGroup) {
+      var groupConfigs = [];
+      var groupData = {
+        "cluster_name": clusterName,
+        "group_name": configGroup.name,
+        "tag": configGroup.service.id,
+        "description": configGroup.description,
+        "hosts": [],
+        "desired_configs": []
+      };
+      configGroup.hosts.forEach(function (hostName) {
+        groupData.hosts.push({"host_name": hostName});
+      });
+      //wrap properties into Em.Object to make them compatible with 
buildGroupDesiredConfigs method
+      configGroup.properties.forEach(function (property) {
+        groupConfigs.push(Em.Object.create(property));
+      });
+      groupData.desired_configs = 
serviceConfigController.buildGroupDesiredConfigs.call(serviceConfigController, 
groupConfigs);
+      sendData.push({"ConfigGroup": groupData});
+    }, this);
+    this.applyConfigurationGroups(sendData);
+  },
+
+  applyConfigurationGroups: function (sendData) {
+    var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + 
'/config_groups';
+    this.ajax({
+      type: 'POST',
+      url: url,
+      data: JSON.stringify(sendData)
+    });
+  },
+
   createGlobalSiteObj: function () {
     var globalSiteProperties = {};
     var globalSiteObj = this.get('globals');

Reply via email to