You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/08/27 07:14:18 UTC
git commit: AMBARI-3031. Set mapreduce.admin.user.env in
mapred-site.xml - installer fix. (srimanth)
Updated Branches:
refs/heads/branch-1.4 48959aa93 -> 00e1d98ab
AMBARI-3031. Set mapreduce.admin.user.env in mapred-site.xml - installer fix. (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/00e1d98a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/00e1d98a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/00e1d98a
Branch: refs/heads/branch-1.4
Commit: 00e1d98ab878b283e62d4eb74762a59e8c43b236
Parents: 48959aa
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Mon Aug 26 22:08:06 2013 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Mon Aug 26 22:08:06 2013 -0700
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 46 ++------------------
.../app/controllers/wizard/step8_controller.js | 26 +++++------
ambari-web/app/utils/config.js | 39 ++++++++++++++++-
3 files changed, 54 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00e1d98a/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 228b21c..841fcc6 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -104,26 +104,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
*/
savedSiteNameToServerServiceConfigDataMap: {},
-
- /**
- * XML characters which should be escaped in values
- * http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML
- */
- xmlEscapeMap: {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': '"',
- "'": '''
- },
- xmlUnEscapeMap: {
- "&": "&",
- "<": "<",
- ">": ">",
- """: '"',
- "'": "'"
- },
-
isSubmitDisabled: function () {
return (!(this.stepConfigs.everyProperty('errorCount', 0)) || this.get('isApplyingChanges'));
}.property('stepConfigs.@each.errorCount', 'isApplyingChanges'),
@@ -1374,7 +1354,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name) && !heapsizeException.contains(_globalSiteObj.name)) {
_globalSiteObj.value += "m";
}
- globalSiteProperties[_globalSiteObj.name] = this.escapeXMLCharacters(_globalSiteObj.value);
+ globalSiteProperties[_globalSiteObj.name] = App.config.escapeXMLCharacters(_globalSiteObj.value);
this.recordHostOverride(_globalSiteObj, 'global', tagName, this);
//console.log("TRACE: name of the global property is: " + _globalSiteObj.name);
//console.log("TRACE: value of the global property is: " + _globalSiteObj.value);
@@ -1448,7 +1428,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
var coreSiteObj = this.get('uiConfigs').filterProperty('filename', 'core-site.xml');
var coreSiteProperties = {};
coreSiteObj.forEach(function (_coreSiteObj) {
- coreSiteProperties[_coreSiteObj.name] = this.escapeXMLCharacters(_coreSiteObj.value);
+ coreSiteProperties[_coreSiteObj.name] = App.config.escapeXMLCharacters(_coreSiteObj.value);
this.recordHostOverride(_coreSiteObj, 'core-site', tagName, this);
}, this);
return {"type": "core-site", "tag": tagName, "properties": coreSiteProperties};
@@ -1469,33 +1449,13 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
siteObj = this.getHiveSiteObj(siteObj);
}
siteObj.forEach(function (_siteObj) {
- siteProperties[_siteObj.name] = this.escapeXMLCharacters(_siteObj.value);
+ siteProperties[_siteObj.name] = App.config.escapeXMLCharacters(_siteObj.value);
this.recordHostOverride(_siteObj, siteName, tagName, this);
}, this);
return {"type": siteName, "tag": tagName, "properties": siteProperties};
},
/**
- * 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.
- *
- * Special characters in XML are defined at
- * http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML
- */
- escapeXMLCharacters: function(value) {
- var self = this;
- // To prevent double/triple replacing '>' to '>gt;' to '>gt;gt', we need
- // to first unescape all XML chars, and then escape them again.
- var newValue = String(value).replace(/(&|<|>|"|')/g, function (s) {
- return self.xmlUnEscapeMap[s];
- });
- return String(newValue).replace(/[&<>"']/g, function (s) {
- return self.xmlEscapeMap[s];
- });
- },
-
- /**
* create site object for Oozie
* @param siteObj
* @return {Object}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00e1d98a/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 5d49005..481fc4c 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1379,7 +1379,7 @@ App.WizardStep8Controller = Em.Controller.extend({
if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name) && !heapsizeException.contains(_globalSiteObj.name)) {
globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value + "m";
} else {
- globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value;
+ globalSiteProperties[_globalSiteObj.name] = App.config.escapeXMLCharacters(_globalSiteObj.value);
}
console.log("STEP8: name of the global property is: " + _globalSiteObj.name);
console.log("STEP8: value of the global property is: " + _globalSiteObj.value);
@@ -1414,11 +1414,11 @@ App.WizardStep8Controller = Em.Controller.extend({
}
coreSiteObj.forEach(function (_coreSiteObj) {
if ((isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) && (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) && (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
- coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
+ coreSiteProperties[_coreSiteObj.name] = App.config.escapeXMLCharacters(_coreSiteObj.value);
this._recordHostOverrideFromObj(_coreSiteObj, 'core-site', 'version1', this);
}
if (isHCFSSelected && _coreSiteObj.name == "fs.default.name") {
- coreSiteProperties[_coreSiteObj.name] = this.get('globals').someProperty('name', 'fs_glusterfs_default_name') ? this.get('globals').findProperty('name', 'fs_glusterfs_default_name').value : null;
+ coreSiteProperties[_coreSiteObj.name] = this.get('globals').someProperty('name', 'fs_glusterfs_default_name') ? App.config.escapeXMLCharacters(this.get('globals').findProperty('name', 'fs_glusterfs_default_name').value) : null;
}
console.log("STEP*: name of the property is: " + _coreSiteObj.name);
console.log("STEP8: value of the property is: " + _coreSiteObj.value);
@@ -1430,7 +1430,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var hdfsSiteObj = this.get('configs').filterProperty('filename', 'hdfs-site.xml');
var hdfsProperties = {};
hdfsSiteObj.forEach(function (_configProperty) {
- hdfsProperties[_configProperty.name] = _configProperty.value;
+ hdfsProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'hdfs-site', 'version1', this);
console.log("STEP*: name of the property is: " + _configProperty.name);
console.log("STEP8: value of the property is: " + _configProperty.value);
@@ -1442,7 +1442,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var hueSiteObj = this.get('configs').filterProperty('filename', 'hue-site.xml');
var hueProperties = {};
hueSiteObj.forEach(function (_configProperty) {
- hueProperties[_configProperty.name] = _configProperty.value;
+ hueProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'hue-site', 'version1', this);
console.log("STEP*: name of the property is: " + _configProperty.name);
console.log("STEP8: value of the property is: " + _configProperty.value);
@@ -1454,7 +1454,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'mapred-site.xml');
var mrProperties = {};
configs.forEach(function (_configProperty) {
- mrProperties[_configProperty.name] = _configProperty.value;
+ mrProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'mapred-site', 'version1', this);
console.log("STEP*: name of the property is: " + _configProperty.name);
console.log("STEP8: value of the property is: " + _configProperty.value);
@@ -1466,7 +1466,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'yarn-site.xml');
var mrProperties = {};
configs.forEach(function (_configProperty) {
- mrProperties[_configProperty.name] = _configProperty.value;
+ mrProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'yarn-site', 'version1', this);
console.log("STEP*: name of the property is: " + _configProperty.name);
console.log("STEP8: value of the property is: " + _configProperty.value);
@@ -1478,7 +1478,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'capacity-scheduler.xml');
var csProperties = {};
configs.forEach(function (_configProperty) {
- csProperties[_configProperty.name] = _configProperty.value;
+ csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'capacity-scheduler', 'version1', this);
console.log("STEP*: name of the property is: " + _configProperty.name);
console.log("STEP8: value of the property is: " + _configProperty.value);
@@ -1490,7 +1490,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'mapred-queue-acls.xml');
var mqProperties = {};
configs.forEach(function (_configProperty) {
- mqProperties[_configProperty.name] = _configProperty.value;
+ mqProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'mapred-queue-acls', 'version1', this);
console.log("STEP*: name of the property is: " + _configProperty.name);
console.log("STEP8: value of the property is: " + _configProperty.value);
@@ -1502,7 +1502,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'hbase-site.xml');
var hbaseProperties = {};
configs.forEach(function (_configProperty) {
- hbaseProperties[_configProperty.name] = _configProperty.value;
+ hbaseProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'hbase-site', 'version1', this);
}, this);
return {type: 'hbase-site', tag: 'version1', properties: hbaseProperties};
@@ -1512,7 +1512,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'oozie-site.xml');
var oozieProperties = {};
configs.forEach(function (_configProperty) {
- oozieProperties[_configProperty.name] = _configProperty.value;
+ oozieProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'oozie-site', 'version1', this);
}, this);
var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
@@ -1541,7 +1541,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'hive-site.xml');
var hiveProperties = {};
configs.forEach(function (_configProperty) {
- hiveProperties[_configProperty.name] = _configProperty.value;
+ hiveProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'hive-site', 'version1', this);
}, this);
var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
@@ -1567,7 +1567,7 @@ App.WizardStep8Controller = Em.Controller.extend({
var configs = this.get('configs').filterProperty('filename', 'webhcat-site.xml');
var webHCatProperties = {};
configs.forEach(function (_configProperty) {
- webHCatProperties[_configProperty.name] = _configProperty.value;
+ webHCatProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
this._recordHostOverrideFromObj(_configProperty, 'webhcat-site', 'version1', this);
}, this);
return {type: 'webhcat-site', tag: 'version1', properties: webHCatProperties};
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/00e1d98a/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 3bce8c6..cdc482c 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -24,7 +24,44 @@ var configGroupsByTag = [];
var globalPropertyToServicesMap = null;
App.config = Em.Object.create({
-
+ /**
+ * XML characters which should be escaped in values
+ * http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML
+ */
+ xmlEscapeMap: {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': '"',
+ "'": '''
+ },
+ xmlUnEscapeMap: {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ """: '"',
+ "'": "'"
+ },
+
+ /**
+ * 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.
+ *
+ * Special characters in XML are defined at
+ * http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML
+ */
+ escapeXMLCharacters: function(value) {
+ var self = this;
+ // To prevent double/triple replacing '>' to '>gt;' to '>gt;gt', we need
+ // to first unescape all XML chars, and then escape them again.
+ var newValue = String(value).replace(/(&|<|>|"|')/g, function (s) {
+ return self.xmlUnEscapeMap[s];
+ });
+ return String(newValue).replace(/[&<>"']/g, function (s) {
+ return self.xmlEscapeMap[s];
+ });
+ },
preDefinedServiceConfigs: function(){
var configs = this.get('preDefinedConfigProperties');
var services = [];