You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/01/21 12:56:32 UTC

git commit: AMBARI-4366 Manage ZooKeeper configs with zoo.cfg. (atkach)

Updated Branches:
  refs/heads/trunk 14bc54518 -> fcfbf01aa


AMBARI-4366 Manage ZooKeeper configs with zoo.cfg. (atkach)


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

Branch: refs/heads/trunk
Commit: fcfbf01aa6a0848b66558a9da12fde2e5aa41d27
Parents: 14bc545
Author: atkach <at...@hortonworks.com>
Authored: Tue Jan 21 13:56:26 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Tue Jan 21 13:56:26 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/info/configs.js |  4 +++-
 ambari-web/app/controllers/wizard/step8_controller.js   | 11 +++++++++++
 ambari-web/app/data/service_configs.js                  |  5 +++--
 ambari-web/app/utils/config.js                          |  8 +++++++-
 4 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fcfbf01a/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 403436d..c92bef8 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -1289,6 +1289,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     this.setNewTagNames(serviceConfigTags);
     var siteNameToServerDataMap = {};
     var configController = App.router.get('configurationController');
+    var filenameExceptions = App.config.get('filenameExceptions');
 
     serviceConfigTags.forEach(function (_serviceTags) {
       if (_serviceTags.siteName === 'global') {
@@ -1316,7 +1317,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
           }
         }
       } else {
-        var siteConfigs = this.get('uiConfigs').filterProperty('filename', _serviceTags.siteName + '.xml');
+        var filename = (filenameExceptions.contains(_serviceTags.siteName)) ? _serviceTags.siteName : _serviceTags.siteName + '.xml';
+        var siteConfigs = this.get('uiConfigs').filterProperty('filename', filename);
         var serverConfigs = this.createSiteObj(_serviceTags.siteName, _serviceTags.newTagName, siteConfigs);
         siteNameToServerDataMap[_serviceTags.siteName] = serverConfigs;
         var loadedProperties = configController.getConfigsByTags([{siteName: _serviceTags.siteName, tagName: this.loadedClusterSiteToTagMap[_serviceTags.siteName]}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fcfbf01a/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 c33751e..23da6c7 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1506,6 +1506,7 @@ App.WizardStep8Controller = Em.Controller.extend({
       this.get('serviceConfigTags').pushObject(this.createStormSiteObj('STORM'));
     }
     if (selectedServices.someProperty('serviceName', 'ZOOKEEPER')) {
+      this.get('serviceConfigTags').pushObject(this.createZooCfgObj());
       this.get('serviceConfigTags').pushObject(this.createLog4jObj('ZOOKEEPER'));
     }
 
@@ -1832,6 +1833,16 @@ App.WizardStep8Controller = Em.Controller.extend({
     return {type: 'webhcat-site', tag: 'version1', properties: webHCatProperties};
   },
 
+  createZooCfgObj: function () {
+    var configs = this.get('configs').filterProperty('filename', 'zoo.cfg');
+    var csProperties = {};
+    configs.forEach(function (_configProperty) {
+      csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
+      this._recordHostOverrideFromObj(_configProperty, 'zoo.cfg', 'version1', this);
+    }, this);
+    return {type: 'zoo.cfg', tag: 'version1', properties: csProperties};
+  },
+
   createStormSiteObj: function (s) {
     var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
     var stormProperties = {};

http://git-wip-us.apache.org/repos/asf/ambari/blob/fcfbf01a/ambari-web/app/data/service_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/service_configs.js b/ambari-web/app/data/service_configs.js
index 0a8a6cb..845c197 100644
--- a/ambari-web/app/data/service_configs.js
+++ b/ambari-web/app/data/service_configs.js
@@ -156,9 +156,10 @@ module.exports = [
     configCategories: [
       App.ServiceConfigCategory.create({ name: 'ZooKeeper Server', displayName : 'ZooKeeper Server'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedZooLog4j', displayName : 'Custom zoo-log4j.xml', siteFileName: 'zoo-log4j.xml', canAddProperty: true})
+      App.ServiceConfigCategory.create({ name: 'AdvancedZooLog4j', displayName : 'Custom zoo-log4j.xml', siteFileName: 'zoo-log4j.xml', canAddProperty: true}),
+      App.ServiceConfigCategory.create({ name: 'AdvancedZooCfg', displayName : 'Custom zoo.cfg', siteFileName: 'zoo.cfg', canAddProperty: true})
     ],
-    sites: ['global', 'zoo-log4j'],
+    sites: ['global', 'zoo-log4j', 'zoo.cfg'],
     configs: []
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fcfbf01a/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 2f2d49e..edb4b87 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -46,6 +46,11 @@ App.config = Em.Object.create({
   CONFIG_GROUP_NAME_MAX_LENGTH: 40,
 
   /**
+   * filename exceptions used to support substandard sitenames which don't have "xml" extension
+   */
+  filenameExceptions: ['zoo.cfg'],
+
+  /**
    * Since values end up in XML files (core-sit.xml, etc.), certain
    * XML sensitive characters should be escaped. If not we will have
    * an invalid XML document, and services will fail to start. 
@@ -230,6 +235,7 @@ App.config = Em.Object.create({
     var globalConfigs = [];
     var preDefinedConfigs = this.get('preDefinedGlobalProperties').concat(this.get('preDefinedSiteProperties'));
     var mappingConfigs = [];
+    var filenameExceptions = this.get('filenameExceptions');
     tags.forEach(function (_tag) {
       var isAdvanced = null;
       var properties = configGroups.filter(function (serviceConfigProperties) {
@@ -243,7 +249,7 @@ App.config = Em.Object.create({
           name: index,
           value: properties[index],
           defaultValue: properties[index],
-          filename: _tag.siteName + ".xml",
+          filename: (filenameExceptions.contains(_tag.siteName)) ? _tag.siteName : _tag.siteName + ".xml",
           isUserProperty: false,
           isOverridable: true,
           serviceName: serviceName,