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/07/01 18:12:39 UTC
git commit: AMBARI-6335 Add service wizard removes any new property
added to core-site and global after cluster installation. (atkach)
Repository: ambari
Updated Branches:
refs/heads/branch-1.6.1 86b20851b -> 15bb92e88
AMBARI-6335 Add service wizard removes any new property added to core-site and global after cluster installation. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/15bb92e8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/15bb92e8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/15bb92e8
Branch: refs/heads/branch-1.6.1
Commit: 15bb92e885ebedadb0f63fe0b41e940bdf9f3cb7
Parents: 86b2085
Author: atkach <at...@hortonworks.com>
Authored: Tue Jul 1 19:12:13 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Tue Jul 1 19:12:13 2014 +0300
----------------------------------------------------------------------
.../controllers/global/cluster_controller.js | 2 +-
.../app/controllers/wizard/step7_controller.js | 31 ++++++++-
.../app/controllers/wizard/step8_controller.js | 55 ++++++++++------
ambari-web/app/utils/config.js | 67 ++++++++++++++------
4 files changed, 113 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/15bb92e8/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index d148173..df70820 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -183,7 +183,7 @@ App.ClusterController = Em.Controller.extend({
} else {
// We want live data here
var nagiosServer = App.HostComponent.find().findProperty('componentName', 'NAGIOS_SERVER');
- if (this.get('isLoaded')) {
+ if (this.get('isLoaded') && nagiosServer) {
this.set('isNagiosUrlLoaded', false);
App.ajax.send({
name: 'hosts.for_quick_links',
http://git-wip-us.apache.org/repos/asf/ambari/blob/15bb92e8/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 d5db177..7c17c8c 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -18,6 +18,7 @@
var App = require('app');
var numberUtils = require('utils/number_utils');
+var stringUtils = require('utils/string_utils');
/**
* By Step 7, we have the following information stored in App.db and set on this
* controller by the router.
@@ -794,18 +795,44 @@ App.WizardStep7Controller = Em.Controller.extend({
*/
setInstalledServiceConfigs: function (serviceConfigTags, configs) {
var configsMap = {};
+ var configTypeMap = {};
+ var configMixin = App.get('config');
+
App.router.get('configurationController').getConfigsByTags(serviceConfigTags).forEach(function (configSite) {
$.extend(configsMap, configSite.properties);
+ for (var name in configSite.properties) {
+ configTypeMap[name] = configSite.type;
+ }
});
configs.forEach(function (_config) {
- if (configsMap[_config.name] !== undefined) {
+ if (!Em.isNone(configsMap[_config.name])) {
// prevent overriding already edited properties
if (_config.defaultValue != configsMap[_config.name])
_config.value = configsMap[_config.name];
_config.defaultValue = configsMap[_config.name];
App.config.handleSpecialProperties(_config);
+ delete configsMap[_config.name];
}
- })
+ });
+
+ //add user properties
+ for (var name in configsMap) {
+ configs.push(configMixin.addUserProperty({
+ id: 'site property',
+ name: name,
+ serviceName: configMixin.getServiceNameByConfigType(configTypeMap[name]),
+ value: configsMap[name],
+ defaultValue: configsMap[name],
+ filename: (configMixin.get('filenameExceptions').contains(configTypeMap[name])) ? configTypeMap[name] : configTypeMap[name] + '.xml',
+ category: 'Advanced',
+ isUserProperty: true,
+ isOverridable: true,
+ overrides: [],
+ isRequired: true,
+ isVisible: true,
+ showLabel: true
+ }, false, []));
+ }
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/15bb92e8/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 3b39f2b..2beff37 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -152,6 +152,14 @@ App.WizardStep8Controller = Em.Controller.extend({
}.property('content.services').cacheable(),
/**
+ * List of installed and selected services
+ * @type {Object[]}
+ */
+ installedServices: function () {
+ return this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled');
+ }.property('content.services').cacheable(),
+
+ /**
* Ajax-requests count
* @type {number}
*/
@@ -1339,16 +1347,21 @@ App.WizardStep8Controller = Em.Controller.extend({
var self = this;
var selectedServices = this.get('selectedServices');
var coreSiteObject = this.createCoreSiteObj();
+ var tag = 'version1';
+
if (this.get('content.controllerName') == 'installerController') {
this.get('serviceConfigTags').pushObject(coreSiteObject);
- this.get('serviceConfigTags').pushObject(this.createSiteObj('hdfs-site', false));
- this.get('serviceConfigTags').pushObject(this.createLog4jObj('hdfs'));
+ this.get('serviceConfigTags').pushObject(this.createSiteObj('hdfs-site', false, tag));
+ this.get('serviceConfigTags').pushObject(this.createLog4jObj('hdfs', tag));
}
- var globalSiteObj = this.createGlobalSiteObj();
+ var globalSiteObj = this.createGlobalSiteObj(tag);
if (this.get('content.controllerName') == 'addServiceController') {
- globalSiteObj.tag = 'version' + (new Date).getTime();
- coreSiteObject.tag = 'version' + (new Date).getTime();
+ tag = 'version' + (new Date).getTime();
+ 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);
@@ -1405,20 +1418,20 @@ App.WizardStep8Controller = Em.Controller.extend({
if (objMap.hasOwnProperty(serviceName)) {
if (selectedServices.someProperty('serviceName', serviceName)) {
objMap[serviceName].site.forEach(function (site) {
- self.get('serviceConfigTags').pushObject(self.createSiteObj(site.filename, !site.isXmlFile));
+ self.get('serviceConfigTags').pushObject(self.createSiteObj(site.filename, !site.isXmlFile, tag));
});
objMap[serviceName].log4j.forEach(function (log4j) {
- self.get('serviceConfigTags').pushObject(self.createLog4jObj(log4j));
+ self.get('serviceConfigTags').pushObject(self.createLog4jObj(log4j, tag));
});
}
}
}
if (selectedServices.someProperty('serviceName', 'STORM')) {
- this.get('serviceConfigTags').pushObject(this.createStormSiteObj());
+ this.get('serviceConfigTags').pushObject(this.createStormSiteObj(tag));
}
if (selectedServices.someProperty('serviceName', 'ZOOKEEPER')) {
- this.get('serviceConfigTags').pushObject(this.createZooCfgObj());
+ this.get('serviceConfigTags').pushObject(this.createZooCfgObj(tag));
}
},
@@ -1549,7 +1562,7 @@ App.WizardStep8Controller = Em.Controller.extend({
* @returns {{type: string, tag: string, properties: {}}}
* @method createGlobalSiteObj
*/
- createGlobalSiteObj: function () {
+ createGlobalSiteObj: function (tag) {
var globalSiteProperties = {};
var globalSiteObj = this.get('globals');
var isGLUSTERFSSelected = this.get('selectedServices').someProperty('serviceName', 'GLUSTERFS');
@@ -1575,7 +1588,7 @@ App.WizardStep8Controller = Em.Controller.extend({
}, this);
// we don't expose gmond_user to the user; it needs to be the same as gmetad_user
globalSiteProperties['gmond_user'] = globalSiteProperties['gmetad_user'];
- return {"type": "global", "tag": "version1", "properties": globalSiteProperties};
+ return {"type": "global", "tag": tag, "properties": globalSiteProperties};
},
/**
@@ -1628,10 +1641,11 @@ App.WizardStep8Controller = Em.Controller.extend({
* Create siteObj for custom service with it own configs
* @param {string} site
* @param {bool} isNonXmlFile
+ * @param tag
* @returns {{type: string, tag: string, properties: {}}}
* @method createSiteObj
*/
- createSiteObj: function (site, isNonXmlFile) {
+ createSiteObj: function (site, isNonXmlFile, tag) {
var properties = {};
if (!!isNonXmlFile) {
this.get('configs').filterProperty('filename', site + '.xml').forEach(function (_configProperty) {
@@ -1642,39 +1656,42 @@ App.WizardStep8Controller = Em.Controller.extend({
properties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
}, this);
}
- return {"type": site, "tag": "version1", "properties": properties };
+ return {"type": site, "tag": tag, "properties": properties };
},
/**
* Create log4j object for custom service with it own configs
* @param {string} site
+ * @param {string} tag
* @returns {{type: string, tag: string, properties: {}}}
* @method createLog4jObj
*/
- createLog4jObj: function (site) {
- return this.createSiteObj(site + '-log4j', true);
+ createLog4jObj: function (site, tag) {
+ return this.createSiteObj(site + '-log4j', true, tag);
},
/**
* Create ZooKeeper Cfg Object
+ * @param tag
* @returns {{type: string, tag: string, properties: {}}}
* @method createZooCfgObj
*/
- createZooCfgObj: function () {
+ createZooCfgObj: function (tag) {
var configs = this.get('configs').filterProperty('filename', 'zoo.cfg');
var csProperties = {};
configs.forEach(function (_configProperty) {
csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
}, this);
- return {type: 'zoo.cfg', tag: 'version1', properties: csProperties};
+ return {type: 'zoo.cfg', tag: tag, properties: csProperties};
},
/**
* Create site obj for Storm
* Some config-properties should be modified in custom way
+ * @param tag
* @returns {{type: string, tag: string, properties: {}}}
* @method createStormSiteObj
*/
- createStormSiteObj: function () {
+ createStormSiteObj: function (tag) {
var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
var stormProperties = {};
var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts", "worker.childopts"];
@@ -1689,7 +1706,7 @@ App.WizardStep8Controller = Em.Controller.extend({
stormProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
}
}, this);
- return {type: 'storm-site', tag: 'version1', properties: stormProperties};
+ return {type: 'storm-site', tag: tag, properties: stormProperties};
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/15bb92e8/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 90ad76b..8378c57 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -423,7 +423,8 @@ App.config = Em.Object.create({
* merge stored configs with pre-defined
* @param storedConfigs
* @param advancedConfigs
- * @return {*}
+ * @param selectedServiceNames
+ * @return {array}
*/
mergePreDefinedWithStored: function (storedConfigs, advancedConfigs, selectedServiceNames) {
var mergedConfigs = [];
@@ -462,25 +463,7 @@ App.config = Em.Object.create({
configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent : true;
configData.showLabel = stored.showLabel !== false;
} else if (!preDefined && stored) {
- configData = {
- id: stored.id,
- name: stored.name,
- displayName: stored.name,
- serviceName: stored.serviceName,
- value: stored.value,
- defaultValue: stored.defaultValue,
- displayType: stringUtils.isSingleLine(stored.value) ? 'advanced' : 'multiLine',
- filename: stored.filename,
- category: 'Advanced',
- isUserProperty: stored.isUserProperty === true,
- isOverridable: true,
- overrides: stored.overrides,
- isRequired: true,
- isVisible: stored.isVisible,
- showLabel: stored.showLabel !== false
- };
-
- this.calculateConfigProperties(configData, isAdvanced, advancedConfigs);
+ this.addUserProperty(stored, isAdvanced, advancedConfigs);
} else if (preDefined && !stored) {
configData = preDefined;
configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent : true;
@@ -973,6 +956,50 @@ App.config = Em.Object.create({
}, this);
}
},
+
+ /**
+ * identify service name of config by its config's type
+ * @param type
+ * @return {string|null}
+ */
+ getServiceNameByConfigType: function (type) {
+ var preDefinedServiceConfigs = this.get('preDefinedServiceConfigs');
+ var service = preDefinedServiceConfigs.find(function (serviceConfig) {
+ return (serviceConfig.sites.contains(type));
+ }, this);
+ return service && service.serviceName;
+ },
+
+ /**
+ * add user property
+ * @param stored
+ * @param isAdvanced
+ * @param advancedConfigs
+ * @return {Object}
+ */
+ addUserProperty: function (stored, isAdvanced, advancedConfigs) {
+ var configData = {
+ id: stored.id,
+ name: stored.name,
+ displayName: stored.name,
+ serviceName: stored.serviceName,
+ value: stored.value,
+ defaultValue: stored.defaultValue,
+ displayType: stringUtils.isSingleLine(stored.value) ? 'advanced' : 'multiLine',
+ filename: stored.filename,
+ category: 'Advanced',
+ isUserProperty: stored.isUserProperty === true,
+ isOverridable: true,
+ overrides: stored.overrides,
+ isRequired: true,
+ isVisible: stored.isVisible,
+ showLabel: stored.showLabel !== false
+ };
+
+ App.get('config').calculateConfigProperties(configData, isAdvanced, advancedConfigs);
+ return configData;
+ },
+
complexConfigs: [
{
"id": "site property",