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/02/18 14:46:49 UTC
git commit: AMBARI-4709 Refactor configurations loading. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 746e68fc6 -> 1b213b46a
AMBARI-4709 Refactor configurations loading. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1b213b46
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1b213b46
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1b213b46
Branch: refs/heads/trunk
Commit: 1b213b46a7e8646d65bef3abd14cca1cb32bb934
Parents: 746e68f
Author: atkach <at...@hortonworks.com>
Authored: Tue Feb 18 15:43:51 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Tue Feb 18 15:43:51 2014 +0200
----------------------------------------------------------------------
.../wizard/stack/hdp/version2.0.1/FALCON.json | 161 +++++++++++++++
.../global/configuration_controller.js | 24 +--
.../controllers/main/service/info/configs.js | 205 +------------------
.../app/controllers/wizard/step7_controller.js | 66 +-----
ambari-web/app/utils/config.js | 59 +-----
ambari-web/app/utils/db.js | 2 +-
6 files changed, 182 insertions(+), 335 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b213b46/ambari-web/app/assets/data/wizard/stack/hdp/version2.0.1/FALCON.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/wizard/stack/hdp/version2.0.1/FALCON.json b/ambari-web/app/assets/data/wizard/stack/hdp/version2.0.1/FALCON.json
new file mode 100644
index 0000000..2b88c65
--- /dev/null
+++ b/ambari-web/app/assets/data/wizard/stack/hdp/version2.0.1/FALCON.json
@@ -0,0 +1,161 @@
+{
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations?fields=*",
+ "items" : [
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/falcon_local_dir",
+ "StackConfigurations" : {
+ "property_description" : "Falcon directory to store different data.",
+ "property_name" : "falcon_local_dir",
+ "property_value" : "/hadoop/falcon",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "global.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/falcon_port",
+ "StackConfigurations" : {
+ "property_description" : "Falcon server port.",
+ "property_name" : "falcon_port",
+ "property_value" : "15000",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "global.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/falcon_store_uri",
+ "StackConfigurations" : {
+ "property_description" : "Falcon store URI.",
+ "property_name" : "falcon_store_uri",
+ "property_value" : "file:///hadoop/falcon/store",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "global.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/falcon_user",
+ "StackConfigurations" : {
+ "property_description" : "Falcon user.",
+ "property_name" : "falcon_user",
+ "property_value" : "falcon",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "global.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-action-create",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-action-create",
+ "property_value" : "\n now=org.apache.oozie.extensions.OozieELExtensions#ph2_now,\n today=org.apache.oozie.extensions.OozieELExtensions#ph2_today,\n yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday,\n currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth,\n lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth,\n currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear,\n lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear,\n latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,\n future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo,\n formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime,\n user=org.apache.oozie.coord.CoordELFunctions#coord_user\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-action-create-inst",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-action-create-inst",
+ "property_value" : "\n now=org.apache.oozie.extensions.OozieELExtensions#ph2_now_inst,\n today=org.apache.oozie.extensions.OozieELExtensions#ph2_today_inst,\n yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday_inst,\n currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth_inst,\n lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth_inst,\n currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear_inst,\n lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear_inst,\n latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,\n future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo,\n formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime,\n user=org.apache.oozie.coord.CoordELFunctions#coord_user\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-action-start",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-action-start",
+ "property_value" : "\n now=org.apache.oozie.extensions.OozieELExtensions#ph2_now,\n today=org.apache.oozie.extensions.OozieELExtensions#ph2_today,\n yesterday=org.apache.oozie.extensions.OozieELExtensions#ph2_yesterday,\n currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_currentMonth,\n lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph2_lastMonth,\n currentYear=org.apache.oozie.extensions.OozieELExtensions#ph2_currentYear,\n lastYear=org.apache.oozie.extensions.OozieELExtensions#ph2_lastYear,\n latest=org.apache.oozie.coord.CoordELFunctions#ph3_coord_latest,\n future=org.apache.oozie.coord.CoordELFunctions#ph3_coord_future,\n dataIn=org.apache.oozie.extensions.OozieELExtensions#ph3_dataIn,\n instanceTime=org.apache.oozie.coord.CoordELFunctions#ph3_coord_nominalTime,\n dateOffset=org.apache.oozie.coord.CoordELFunctions#ph3_coord_dateOffset,\n formatTime=org.apache.oozie.coord.CoordELFunctio
ns#ph3_coord_formatTime,\n user=org.apache.oozie.coord.CoordELFunctions#coord_user\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-job-submit-data",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-job-submit-data",
+ "property_value" : "\n now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo,\n today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo,\n yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo,\n currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo,\n lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo,\n currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo,\n lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo,\n dataIn=org.apache.oozie.extensions.OozieELExtensions#ph1_dataIn_echo,\n instanceTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_wrap,\n formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo,\n dateOffset=org.apache.oozie.coord.CoordELFunctions#ph1_coord_dateOffset_echo,\n user=org.apache.oozie.coord.CoordELFunctions#coord_u
ser\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-job-submit-instances",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-job-submit-instances",
+ "property_value" : "\n now=org.apache.oozie.extensions.OozieELExtensions#ph1_now_echo,\n today=org.apache.oozie.extensions.OozieELExtensions#ph1_today_echo,\n yesterday=org.apache.oozie.extensions.OozieELExtensions#ph1_yesterday_echo,\n currentMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_currentMonth_echo,\n lastMonth=org.apache.oozie.extensions.OozieELExtensions#ph1_lastMonth_echo,\n currentYear=org.apache.oozie.extensions.OozieELExtensions#ph1_currentYear_echo,\n lastYear=org.apache.oozie.extensions.OozieELExtensions#ph1_lastYear_echo,\n formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo,\n latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,\n future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-sla-create",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-sla-create",
+ "property_value" : "\n instanceTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_nominalTime,\n user=org.apache.oozie.coord.CoordELFunctions#coord_user\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ELService.ext.functions.coord-sla-submit",
+ "StackConfigurations" : {
+ "property_description" : "Falcon",
+ "property_name" : "oozie.service.ELService.ext.functions.coord-sla-submit",
+ "property_value" : "\n instanceTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_fixed,\n user=org.apache.oozie.coord.CoordELFunctions#coord_user\n ",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ProxyUserService.proxyuser.falcon.groups",
+ "StackConfigurations" : {
+ "property_description" : "Falcon proxyuser groups",
+ "property_name" : "oozie.service.ProxyUserService.proxyuser.falcon.groups",
+ "property_value" : "*",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/stacks2/HDP/versions/2.1.1/stackServices/FALCON/configurations/oozie.service.ProxyUserService.proxyuser.falcon.hosts",
+ "StackConfigurations" : {
+ "property_description" : "Falcon proxyuser hosts",
+ "property_name" : "oozie.service.ProxyUserService.proxyuser.falcon.hosts",
+ "property_value" : "*",
+ "service_name" : "FALCON",
+ "stack_name" : "HDP",
+ "stack_version" : "2.1.1",
+ "type" : "oozie-site.xml"
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b213b46/ambari-web/app/controllers/global/configuration_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/configuration_controller.js b/ambari-web/app/controllers/global/configuration_controller.js
index a0c2db3..5aa410d 100644
--- a/ambari-web/app/controllers/global/configuration_controller.js
+++ b/ambari-web/app/controllers/global/configuration_controller.js
@@ -23,13 +23,12 @@ App.ConfigurationController = Em.Controller.extend({
getConfigsByTags: function (tags) {
var storedTags = [];
- // Access the Local storage App.db.data.app.configs object only if its defined
- !!App.db.getConfigs() && App.db.getConfigs().forEach(function(site){
- storedTags.push({
- siteName: site.type,
- tagName: site.tag
- })
- });
+ App.db.getConfigs().forEach(function (site) {
+ storedTags.push({
+ siteName: site.type,
+ tagName: site.tag
+ })
+ });
if (this.checkTagsChanges(tags, storedTags)) {
return this.loadFromServer(tags);
} else {
@@ -70,16 +69,11 @@ App.ConfigurationController = Em.Controller.extend({
var loadedConfigs = App.config.loadConfigsByTags(tags);
var storedConfigs = App.db.getConfigs();
loadedConfigs.forEach(function (loadedSite) {
- // Access the Local storage App.db.data.app.configs object only if its defined
- var storedSite = !!storedConfigs && storedConfigs.findProperty('type', loadedSite.type);
+ var storedSite = storedConfigs.findProperty('type', loadedSite.type);
if (storedSite) {
- storedConfigs.findProperty('type', storedSite.type).tag = loadedSite.tag;
- storedConfigs.findProperty('type', storedSite.type).properties = loadedSite.properties;
+ storedSite.tag = loadedSite.tag;
+ storedSite.properties = loadedSite.properties;
} else {
- // Initialize storedConfigs object if it's undefined
- if (storedConfigs === undefined) {
- storedConfigs = [];
- }
storedConfigs.push(loadedSite);
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b213b46/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 3fede70..e89c214 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -59,23 +59,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}.property('App.isHadoop2Stack'),
/**
- * During page load time, we get the host overrides from the server.
- * The current host -> site:tag map is stored below. This will be
- * useful during save, so that removals can also be determined.
- *
- * Example:
- * {
- * 'hostname1':{
- * 'global': 'version1',
- * 'core-site': 'version1',
- * 'hdfs-site', 'tag3187261938'
- * }
- * }
- *
- * @see savedHostToOverrideSiteToTagMap
+ * Map, which contains relation between group and site
+ * to upload overriden properties
*/
loadedGroupToOverrideSiteToTagMap: {},
-
/**
* During page load time the cluster level site to tag
* mapping is stored here.
@@ -88,29 +75,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
* }
*/
loadedClusterSiteToTagMap: {},
-
- /**
- * During page save time, we set the host overrides to the server.
- * The new host -> site:tag map is stored below. This will be
- * useful during save, to update the host's host components. Also,
- * it will be useful in deletion of overrides.
- *
- * Example:
- * {
- * 'hostname1': {
- * 'global': {
- * 'tagName': 'tag3187261938_hostname1',
- * 'map': {
- * 'hadoop_heapsize': '2048m'
- * }
- * }
- * }
- * }
- *
- * @see loadedHostToOverrideSiteToTagMap
- */
- savedHostToOverrideSiteToTagMap: {},
-
/**
* Holds the actual base service-config server data uploaded.
* This is used by the host-override mechanism to update host
@@ -158,7 +122,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
this.get('uiConfigs').clear();
this.get('customConfig').clear();
this.set('loadedGroupToOverrideSiteToTagMap', {});
- this.set('savedHostToOverrideSiteToTagMap', {});
this.set('savedSiteNameToServerServiceConfigDataMap', {});
if (this.get('serviceConfigTags')) {
this.set('serviceConfigTags', null);
@@ -402,8 +365,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
this.addHostNamesToGlobalConfig();
var allConfigs = this.get('globalConfigs').concat(configs);
- //STEP 9: Load and add host override configs
- this.loadServiceConfigHostsOverrides(allConfigs, this.loadedGroupToOverrideSiteToTagMap, this.get('configGroups'));
+ //STEP 9: Load and add overriden configs of group
+ App.config.loadServiceConfigGroupOverrides(allConfigs, this.loadedGroupToOverrideSiteToTagMap, this.get('configGroups'));
var restartData = this.loadActualConfigsAndCalculateRestarts();
//STEP 10: creation of serviceConfig object which contains configs for current service
var serviceConfig = App.config.createServiceConfig(serviceName);
@@ -426,10 +389,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}.observes('selectedConfigGroup'),
- loadServiceConfigHostsOverrides: function (allConfigs, loadedGroupToOverrideSiteToTagMap, configGroups) {
- App.config.loadServiceConfigHostsOverrides(allConfigs, loadedGroupToOverrideSiteToTagMap, configGroups);
- },
-
/**
* Changes format from Object to Array
*
@@ -1404,85 +1363,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
return result;
},
-
- /**
- * Creates host level overrides for service configuration.
- *
- */
- doPUTHostOverridesConfigurationSites: function () {
- var singlePUTHostData = [];
- var savedHostSiteArray = [];
- for (var host in this.savedHostToOverrideSiteToTagMap) {
- for (var siteName in this.savedHostToOverrideSiteToTagMap[host]) {
- var tagName = this.savedHostToOverrideSiteToTagMap[host][siteName].tagName;
- var map = this.savedHostToOverrideSiteToTagMap[host][siteName].map;
- savedHostSiteArray.push(host + "///" + siteName);
- singlePUTHostData.push({
- RequestInfo: {
- query: 'Hosts/host_name=' + host
- },
- Body: {
- Hosts: {
- desired_config: {
- type: siteName,
- tag: tagName,
- properties: map
- }
- }
- }
- });
- }
- }
- // Now cleanup removed overrides
- for (var loadedHost in this.loadedGroupToOverrideSiteToTagMap) {
- for (var loadedSiteName in this.loadedGroupToOverrideSiteToTagMap[loadedHost]) {
- if (!(savedHostSiteArray.contains(loadedHost + "///" + loadedSiteName))) {
- // This host-site combination was loaded, but not saved.
- // Meaning it is not needed anymore. Hence send a DELETE command.
- singlePUTHostData.push({
- RequestInfo: {
- query: 'Hosts/host_name=' + loadedHost
- },
- Body: {
- Hosts: {
- desired_config: {
- type: loadedSiteName,
- tag: this.loadedGroupToOverrideSiteToTagMap[loadedHost][loadedSiteName],
- selected: false
- }
- }
- }
- });
- }
- }
- }
- console.debug("createHostOverrideConfigSites(): PUTting host-overrides. Data=", singlePUTHostData);
- if (singlePUTHostData.length > 0) {
- var url = this.getUrl('', '/hosts');
- var hostOverrideResult = true;
- $.ajax({
- type: 'PUT',
- url: url,
- data: JSON.stringify(singlePUTHostData),
- async: false,
- dataType: 'text',
- timeout: 5000,
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- hostOverrideResult = true;
- console.log("createHostOverrideConfigSites(): SUCCESS:", url, ". RESPONSE:", jsonData);
- },
- error: function (request, ajaxOptions, error) {
- hostOverrideResult = false;
- console.log("createHostOverrideConfigSites(): ERROR:", url, ". RESPONSE:", request.responseText);
- },
- statusCode: require('data/statusCodes')
- });
- return hostOverrideResult;
- }
- return true;
- },
-
/**
* add newTagName property to each config in serviceConfigs
* @param serviceConfigs
@@ -1519,52 +1399,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
return {"type": "global", "tag": tagName, "properties": globalSiteProperties};
},
- recordHostOverride: function (serviceConfigObj, siteName, tagName, self) {
- var overrides = null;
- var name = '';
- if ('get' in serviceConfigObj) {
- overrides = serviceConfigObj.get('overrides');
- name = serviceConfigObj.get('name');
- } else {
- overrides = serviceConfigObj.overrides;
- name = serviceConfigObj.name;
- }
- if(overrides){
- if('get' in overrides) {
- overrides.forEach(function (override) {
- override.get('selectedHostOptions').forEach(function (host) {
- var value = override.get('value');
- self._recordHostOverride(value, host, name, siteName, tagName, self);
- });
- });
- } else {
- for (var value in overrides) {
- overrides[value].forEach(function (host) {
- self._recordHostOverride(value, host, name, siteName, tagName, self);
- });
- }
- }
- }
- },
-
- /**
- * Records all the host overrides per site/tag
- */
-
- _recordHostOverride: function(value, host, serviceConfigObjName, siteName, tagName, self) {
- if (!(host in self.savedHostToOverrideSiteToTagMap)) {
- self.savedHostToOverrideSiteToTagMap[host] = {};
- }
- if (!(siteName in self.savedHostToOverrideSiteToTagMap[host])) {
- self.savedHostToOverrideSiteToTagMap[host][siteName] = {};
- self.savedHostToOverrideSiteToTagMap[host][siteName].map = {};
- }
- var finalTag = tagName + '_' + host;
- console.log("recordHostOverride(): Saving host override for host=" + host + ", site=" + siteName + ", tag=" + finalTag + ", (key,value)=(" + serviceConfigObjName + "," + value + ")");
- self.savedHostToOverrideSiteToTagMap[host][siteName].tagName = finalTag;
- self.savedHostToOverrideSiteToTagMap[host][siteName].map[serviceConfigObjName] = value;
- },
-
/**
* create core site object
* @param tagName
@@ -1595,37 +1429,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
}, this);
return {"type": siteName, "tag": tagName, "properties": siteProperties};
},
-
- /**
- * Set display names of the property from the puppet/global names
- * @param {Array} displayNames a field to be set with displayNames
- * @param {Array} names array of property puppet/global names
- */
- setPropertyDisplayNames: function (displayNames, names) {
- var stepConfigs = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName')).configs;
- names.forEach(function (_name, index) {
- if (stepConfigs.someProperty('name', _name)) {
- displayNames.push(stepConfigs.findProperty('name', _name).displayName);
- }
- }, this);
- },
-
- /**
- * Set property of the site variable
- */
- setSiteProperty: function (key, value, filename) {
- if (filename === 'core-site.xml' && this.get('uiConfigs').filterProperty('filename', 'core-site.xml').someProperty('name', key)) {
- this.get('uiConfigs').filterProperty('filename', 'core-site.xml').findProperty('name', key).value = value;
- return;
- }
- this.get('uiConfigs').pushObject({
- "id": "site property",
- "name": key,
- "value": value,
- "filename": filename
- });
- },
-
/**
* return either specific url for request if testMode is false or testUrl
* @param testUrl
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b213b46/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 8132924..0c059b6 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -193,7 +193,7 @@ App.WizardStep7Controller = Em.Controller.extend({
}, this);
}, this);
}
- App.config.loadServiceConfigHostsOverrides(service.get('configs'), loadedGroupToOverrideSiteToTagMap, service.get('configGroups'));
+ App.config.loadServiceConfigGroupOverrides(service.get('configs'), loadedGroupToOverrideSiteToTagMap, service.get('configGroups'));
var serviceConfig = App.config.createServiceConfig(serviceName);
if (serviceConfig.get('serviceName') === 'HDFS') {
App.config.OnNnHAHideSnn(serviceConfig);
@@ -609,70 +609,6 @@ App.WizardStep7Controller = Em.Controller.extend({
miscConfigs = App.config.miscConfigVisibleProperty(miscConfigs, this.get('selectedServiceNames'));
},
- /**
- * @param {String} siteProperty
- * @param {Array} displayNames An array of display names
- */
- setDisplayMessage: function (siteProperty, displayNames) {
- var displayMsg = null;
- if (displayNames && displayNames.length) {
- if (displayNames.length === 1) {
- displayMsg = siteProperty + ' ' + Em.I18n.t('as') + ' ' + displayNames[0];
- } else {
- var name = null;
- displayNames.forEach(function (_name, index) {
- if (index === 0) {
- name = _name;
- } else if (index === displayNames.length - 1) {
- name = name + ' ' + Em.I18n.t('and') + ' ' + _name;
- } else {
- name = name + ', ' + _name;
- }
- }, this);
- displayMsg = siteProperty + ' ' + Em.I18n.t('as') + ' ' + name;
- }
- } else {
- displayMsg = siteProperty;
- }
- return displayMsg;
- },
-
- /**
- * Set display names of the property tfrom he puppet/global names
- * @param {Array} displayNames a field to be set with displayNames
- * @param {Array} names array of property puppet/global names
- * @param {Array} configProperties array of config properties of the respective service to the name param
- */
- setPropertyDisplayNames: function (displayNames, names, configProperties) {
- names.forEach(function (_name, index) {
- if (configProperties.someProperty('name', _name)) {
- displayNames.push(configProperties.findProperty('name', _name).displayName);
- }
- }, this);
- },
-
- /**
- * Display Error Message with service name, its custom configuration name and displaynames on the page
- * @param {Array} customConfig array with custom configuration, serviceName and displayNames relative to custom configuration
- */
- showCustomConfigErrMsg: function (customConfig) {
-
- App.ModalPopup.show({
- header: Em.I18n.t('installer.step7.ConfigErrMsg.header'),
- primary: Em.I18n.t('ok'),
- secondary: null,
- bodyClass: Ember.View.extend({
- message: Em.I18n.t('installer.step7.ConfigErrMsg.message'),
- siteProperties: customConfig,
- getDisplayMessage: function () {
-
- }.property('customConfig.@each.siteProperties.@each.siteProperty'),
- customConfig: customConfig,
- templateName: require('templates/wizard/step7_custom_config_error')
- })
- });
- },
-
submit: function () {
if (!this.get('isSubmitDisabled')) {
App.router.send('next');
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b213b46/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index e475ebf..7fb8894 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -21,7 +21,6 @@ var stringUtils = require('utils/string_utils');
var serviceComponents = {};
var configGroupsByTag = [];
-var globalPropertyToServicesMap = null;
App.config = Em.Object.create({
/**
@@ -743,54 +742,10 @@ App.config = Em.Object.create({
},
/**
- * Determine the map which shows which services
- * each global property effects.
- *
- * @return {*}
- * Example:
- * {
- * 'hive_pid_dir': ['HIVE'],
- * ...
- * }
- */
- loadGlobalPropertyToServicesMap: function () {
- if (globalPropertyToServicesMap == null) {
- App.ajax.send({
- name: 'config.advanced.global',
- sender: this,
- data: {
- stack2VersionUrl: App.get('stack2VersionURL')
- },
- success: 'loadGlobalPropertyToServicesMapSuccess'
- });
- }
- return globalPropertyToServicesMap;
- },
-
- loadGlobalPropertyToServicesMapSuccess: function (data) {
- globalPropertyToServicesMap = {};
- if (data.items != null) {
- data.items.forEach(function (service) {
- service.configurations.forEach(function (config) {
- if ("global.xml" === config.StackConfigurations.type) {
- if (!(config.StackConfigurations.property_name in globalPropertyToServicesMap)) {
- globalPropertyToServicesMap[config.StackConfigurations.property_name] = [];
- }
- globalPropertyToServicesMap[config.StackConfigurations.property_name].push(service.StackServices.service_name);
- }
- });
- });
- }
- },
-
- /**
- * Hosts can override service configurations per property. This method GETs
- * the overriden configurations and sets only the changed properties into
- * the 'overrides' of serviceConfig.
- *
- *
+ * Get properties from server by type and tag with properties, that belong to group
+ * push them to common {serviceConfigs}
*/
- loadServiceConfigHostsOverrides: function (serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups) {
+ loadServiceConfigGroupOverrides: function (serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups) {
var configKeyToConfigMap = {};
serviceConfigs.forEach(function (item) {
configKeyToConfigMap[item.name] = item;
@@ -815,12 +770,11 @@ App.config = Em.Object.create({
configKeyToConfigMap: configKeyToConfigMap,
typeTagToGroupMap: typeTagToGroupMap
},
- success: 'loadServiceConfigHostsOverridesSuccess'
+ success: 'loadServiceConfigGroupOverridesSuccess'
});
}
},
- loadServiceConfigHostsOverridesSuccess: function (data, opt, params) {
- console.debug("loadServiceConfigHostsOverrides: Data=", data);
+ loadServiceConfigGroupOverridesSuccess: function (data, opt, params) {
data.items.forEach(function (config) {
App.config.loadedConfigurationsCache[config.type + "_" + config.tag] = config.properties;
var group = params.typeTagToGroupMap[config.type + "///" + config.tag];
@@ -851,12 +805,11 @@ App.config = Em.Object.create({
if (!serviceConfig.overrides) {
serviceConfig.set('overrides', []);
}
- console.log("loadServiceConfigHostsOverrides(): [" + group + "] OVERRODE(" + serviceConfig.name + "): " + serviceConfig.value + " -> " + hostOverrideValue);
+ console.log("loadServiceConfigGroupOverridesSuccess(): [" + group + "] OVERRODE(" + serviceConfig.name + "): " + serviceConfig.value + " -> " + hostOverrideValue);
serviceConfig.overrides.push({value: hostOverrideValue, group: group});
}
}
});
- console.log("loadServiceConfigHostsOverrides(): Finished loading.");
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b213b46/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index e5b5417..b1220b8 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -79,7 +79,7 @@ App.db.cleanUp = function () {
App.db.updateStorage = function() {
App.db.data = localStorage.getObject('ambari');
- if (App.db.data && App.db.data.app && App.db.data.app.tables) {
+ if (App.db.data && App.db.data.app && App.db.data.app.tables && App.db.data.app.configs) {
return true;
}
console.warn("local storage is deprecated!");