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

git commit: AMBARI-5002: Oozie log4j properties contains &apos and " instead of real symbols. (jaimin)

Repository: ambari
Updated Branches:
  refs/heads/trunk 3f119e345 -> b4eb05c6e


AMBARI-5002: Oozie log4j properties contains &apos and &quot instead of real symbols. (jaimin)


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

Branch: refs/heads/trunk
Commit: b4eb05c6eafb71b8fc1fdfa1e4e18941e11b6f7a
Parents: 3f119e3
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Fri Mar 7 17:53:50 2014 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Fri Mar 7 17:54:00 2014 -0800

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 10 ++++-
 .../app/controllers/wizard/step8_controller.js  | 43 ++++++++++++--------
 ambari-web/test/installer/step8_test.js         | 27 ++++++++++++
 3 files changed, 60 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b4eb05c6/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 bd753a0..b632b9f 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -1425,8 +1425,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   createSiteObj: function (siteName, tagName, siteObj) {
     var siteProperties = {};
     siteObj.forEach(function (_siteObj) {
-      siteProperties[_siteObj.name] = this.setServerConfigValue(_siteObj.name, _siteObj.value);
-      //this.recordHostOverride(_siteObj, siteName, tagName, this);
+      switch(siteName) {
+        case 'falcon-startup.properties':
+        case 'falcon-runtime.properties':
+          siteProperties[_siteObj.name] = _siteObj.value;
+          break;
+        default:
+          siteProperties[_siteObj.name] = this.setServerConfigValue(_siteObj.name, _siteObj.value);
+      }
     }, this);
     return {"type": siteName, "tag": tagName, "properties": siteProperties};
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4eb05c6/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 71b54a6..bb2e3ba 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1120,7 +1120,7 @@ App.WizardStep8Controller = Em.Controller.extend({
     var coreSiteObject = this.createCoreSiteObj();
     if (this.get('content.controllerName') == 'installerController') {
       this.get('serviceConfigTags').pushObject(coreSiteObject);
-      this.get('serviceConfigTags').pushObject(this.createSiteObj('hdfs-site'));
+      this.get('serviceConfigTags').pushObject(this.createSiteObj('hdfs-site',false));
       this.get('serviceConfigTags').pushObject(this.createLog4jObj('hdfs'));
     }
     var globalSiteObj = this.createGlobalSiteObj();
@@ -1132,29 +1132,29 @@ App.WizardStep8Controller = Em.Controller.extend({
     this.get('serviceConfigTags').pushObject(globalSiteObj);
 
     var objMap = {
-      MAPREDUCE: {site: ['mapred-site'], log4j: ['mapreduce']},
-      MAPREDUCE2: {site: ['mapred-site'], log4j: ['mapreduce2']},
-      YARN: {site: ['yarn-site','capacity-scheduler'], log4j: ['yarn']},
-      HBASE: {site: ['hbase-site'], log4j: ['hbase']},
-      OOZIE: {site: ['oozie-site'], log4j: ['oozie']},
-      HIVE: {site: ['hive-site'], log4j: ['hive','hive-exec']},
-      WEBHCAT: {site: ['webhcat-site'], log4j: []},
-      HUE: {site: ['hue-site'], log4j: []},
+      MAPREDUCE: {site: [{filename: 'mapred-site',isXmlFile: true}], log4j: ['mapreduce']},
+      MAPREDUCE2: {site: [{filename:'mapred-site',isXmlFile: true}], log4j: ['mapreduce2']},
+      YARN: {site: [{filename:'yarn-site',isXmlFile: true},{filename:'capacity-scheduler',isXmlFile: true}], log4j: ['yarn']},
+      HBASE: {site: [{filename:'hbase-site',isXmlFile: true}], log4j: ['hbase']},
+      OOZIE: {site: [{filename:'oozie-site',isXmlFile: true}], log4j: ['oozie']},
+      HIVE: {site: [{filename:'hive-site',isXmlFile: true}], log4j: ['hive','hive-exec']},
+      WEBHCAT: {site: [{filename:'webhcat-site',isXmlFile: true}], log4j: []},
+      HUE: {site: [{filename:'hue-site',isXmlFile: true}], log4j: []},
       PIG: {site: [], log4j: ['pig']},
-      FALCON: {site: ['falcon-startup.properties','falcon-runtime.properties'], log4j: []},
-      TEZ: {site: ['tez-site'], log4j: []},
+      FALCON: {site: [{filename:'falcon-startup.properties',isXmlFile: false},{filename:'falcon-runtime.properties',isXmlFile: false}], log4j: []},
+      TEZ: {site: [{filename:'tez-site',isXmlFile: true}], log4j: []},
       ZOOKEEPER: {site: [], log4j: ['zookeeper']}
     };
 
     if (App.supports.capacitySchedulerUi) {
-      objMap['MAPREDUCE'].site.pushObjects(['capacity-scheduler','mapred-queue-acls']);
+      objMap['MAPREDUCE'].site.pushObjects([{filename:'capacity-scheduler',isXmlFile: true},{filename:'mapred-queue-acls',isXmlFile: true}]);
     }
 
     for(var serviceName in objMap) {
       if (objMap.hasOwnProperty(serviceName)) {
         if (selectedServices.someProperty('serviceName', serviceName)) {
           objMap[serviceName].site.forEach(function(site) {
-            self.get('serviceConfigTags').pushObject(self.createSiteObj(site));
+            self.get('serviceConfigTags').pushObject(self.createSiteObj(site.filename,!site.isXmlFile));
           });
           objMap[serviceName].log4j.forEach(function(log4j) {
             self.get('serviceConfigTags').pushObject(self.createLog4jObj(log4j));
@@ -1358,13 +1358,20 @@ App.WizardStep8Controller = Em.Controller.extend({
   /**
    * Create siteObj for custom service with it own configs
    * @param {string} site
+   * @param {Boolean} isNonXmlFile
    * @returns {{type: string, tag: string, properties: {}}}
    */
-  createSiteObj: function(site) {
+  createSiteObj: function(site,isNonXmlFile) {
     var properties = {};
-    this.get('configs').filterProperty('filename', site + '.xml').forEach(function (_configProperty) {
-      properties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
-    }, this);
+    if (!!isNonXmlFile) {
+      this.get('configs').filterProperty('filename', site + '.xml').forEach(function (_configProperty) {
+        properties[_configProperty.name] = _configProperty.value;
+      },this);
+    } else {
+      this.get('configs').filterProperty('filename', site + '.xml').forEach(function (_configProperty) {
+        properties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
+      },this);
+    }
     return {"type": site, "tag": "version1", "properties": properties };
   },
 
@@ -1374,7 +1381,7 @@ App.WizardStep8Controller = Em.Controller.extend({
    * @returns {{type: string, tag: string, properties: {}}}
    */
   createLog4jObj: function (site) {
-    return this.createSiteObj(site + '-log4j');
+    return this.createSiteObj(site + '-log4j',true);
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4eb05c6/ambari-web/test/installer/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/installer/step8_test.js b/ambari-web/test/installer/step8_test.js
index bf8cae6..7a79930 100644
--- a/ambari-web/test/installer/step8_test.js
+++ b/ambari-web/test/installer/step8_test.js
@@ -125,6 +125,7 @@ describe('App.WizardStep8Controller', function() {
       installerStep8Controller.clearStep();
     });
 
+
     // e - without global and core!
     var tests = Em.A([
       {selectedServices: Em.A(['MAPREDUCE2']),e: 2},
@@ -157,6 +158,32 @@ describe('App.WizardStep8Controller', function() {
       });
     });
 
+    // Verify xml character escaping is not done for log4j files and falcon startup-properties and runtime-properties files.
+    it('escape xml character for installer wizard', function() {
+      var services = Em.A([Em.Object.create({isSelected:true,isInstalled:false,serviceName:'OOZIE'}),
+        Em.Object.create({isSelected:true,isInstalled:false,serviceName:'FALCON'})]);
+
+      var nonXmlConfigs = [
+        {filename: 'oozie-log4j.xml', name: 'p1', value: "'.'v1"},
+        {filename: 'falcon-startup.properties.xml', name: 'p1', value: "'.'v1"} ,
+        {filename: 'falcon-startup.properties.xml', name: 'p2', value: 'v2'},
+        {filename: 'falcon-runtime.properties.xml', name: 'p1', value: "'.'v1"},
+        {filename: 'falcon-runtime.properties.xml', name: 'p2', value: 'v2'}
+      ];
+      installerStep8Controller = App.WizardStep8Controller.create({
+        content: {controllerName: 'installerController', services: services},
+        configs: nonXmlConfigs
+      });
+      installerStep8Controller.createConfigurations();
+      var nonXmlConfigTypes = ['oozie-log4j','falcon-startup.properties','falcon-runtime.properties'];
+      nonXmlConfigTypes.forEach(function(_nonXmlConfigType){
+        var nonXmlConfigTypeObj = installerStep8Controller.get('serviceConfigTags').findProperty('type',_nonXmlConfigType);
+        var nonXmlSitePropertyVal = nonXmlConfigTypeObj.properties['p1'];
+        expect(nonXmlSitePropertyVal).to.equal("'.'v1");
+      });
+      installerStep8Controller.clearStep();
+    });
+
   });
 
   describe('#createSelectedServicesData', function() {