Kaynağa Gözat

AMBARI-2212. Change config loading mechanism to allow for different stack versions. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1487202 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 yıl önce
ebeveyn
işleme
3740bcb53d

+ 3 - 0
CHANGES.txt

@@ -309,6 +309,9 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-2212. Change config loading mechanism to allow for different
+ stack versions. (yusaku)
+
  AMBARI-2207. Add unit tests for Utils. (yusaku)
 
  AMBARI-2206. Add unit tests for wizard steps 2, 5, and 6. (yusaku)

+ 1 - 1
ambari-web/app/app.js

@@ -51,7 +51,7 @@ module.exports = Em.Application.create({
     return '/stacks2/HDP/versions/' + stackVersion.replace(/HDP-/g, '');
   }.property('currentStackVersion'),
   clusterName: null,
-  currentStackVersion: null,
+  currentStackVersion: '',
   currentStackVersionNumber: function(){
     return this.get('currentStackVersion').replace(/HDP(Local)?-/, '');
   }.property('currentStackVersion')

+ 1 - 1
ambari-web/app/controllers/main/admin/security/disable.js

@@ -21,7 +21,7 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
 
   name: 'mainAdminSecurityDisableController',
   secureMapping: require('data/secure_mapping'),
-  configMapping: require('data/config_mapping'),
+  configMapping: App.config.get('configMapping'),
   secureProperties: require('data/secure_properties').configProperties.slice(0),
   stages: [],
   configs: [],

+ 3 - 3
ambari-web/app/controllers/main/service/info/configs.js

@@ -29,9 +29,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   uiConfigs: [],
   customConfig: [],
   isApplyingChanges: false,
-  serviceConfigs: require('data/service_configs'),
-  configs: require('data/config_properties').configProperties,
-  configMapping: require('data/config_mapping'),
+  serviceConfigs: App.config.get('preDefinedServiceConfigs'),
+  configs: App.config.get('preDefinedConfigProperties'),
+  configMapping: App.config.get('configMapping'),
   customConfigs: require('data/custom_configs'),
   
   /**

+ 0 - 1
ambari-web/app/controllers/wizard.js

@@ -429,7 +429,6 @@ App.WizardController = Em.Controller.extend({
     App.db.setSlaveComponentHosts(undefined);
     App.db.setCluster(undefined);
     App.db.setAllHostNames(undefined);
-    App.db.setSlaveProperties(undefined);
     App.db.setInstallOptions(undefined);
     App.db.setAllHostNamesPattern(undefined);
   },

+ 1 - 1
ambari-web/app/controllers/wizard/slave_component_groups_controller.js

@@ -84,7 +84,7 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
   // returns key-value pairs i.e. all fields for slave component for this specific service.
   componentProperties: function (serviceName) {
 
-    var serviceConfigs = require('data/service_configs').findProperty('serviceName', serviceName);
+    var serviceConfigs = App.config.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName);
 
     var configs = [];
     var componentName = null;

+ 1 - 1
ambari-web/app/controllers/wizard/step14_controller.js

@@ -70,7 +70,7 @@ App.WizardStep14Controller = Em.Controller.extend({
 
   configs: [],
   globals: [],
-  configMapping: require('data/config_mapping').all(),
+  configMapping: App.config.get('configMapping').all(),
   newConfigsTag: null,
   createdConfigs: [],
 

+ 2 - 65
ambari-web/app/controllers/wizard/step8_controller.js

@@ -28,7 +28,7 @@ App.WizardStep8Controller = Em.Controller.extend({
   configs: [],
   globals: [],
   ajaxQueue: [],
-  configMapping: require('data/config_mapping').all(),
+  configMapping: App.config.get('configMapping').all(),
   slaveComponentConfig: null,
   isSubmitDisabled: false,
   hasErrorOccurred: false,
@@ -376,43 +376,6 @@ App.WizardStep8Controller = Em.Controller.extend({
     }
   },
 
-  getServiceInfo: function (componentName) {
-    var serviceConfig;
-    switch (componentName) {
-      case 'DATANODE':
-        serviceConfig = {
-          name: 'HDFS',
-          siteName: 'hdfs-site',
-          domain: 'datanode-global'
-        };
-        break;
-      case 'TASKTRACKER':
-        serviceConfig = {
-          name: 'MAPREDUCE',
-          siteName: 'mapred-site',
-          domain: 'tasktracker-global'
-        };
-        break;
-      case 'NODEMANAGER':
-        serviceConfig = {
-          name: 'YARN',
-          siteName: 'yarn-site',
-          domain: 'nodemanager-global'
-        };
-        break;
-      case 'HBASE_REGIONSERVER':
-        serviceConfig = {
-          name: 'HBASE',
-          siteName: 'hbase-site',
-          domain: 'regionserver-global'
-        };
-        break;
-      default:
-        serviceConfig = {};
-    }
-    return serviceConfig;
-  },
-
   /**
    * Load all info about cluster to <code>clusterInfo</code> variable
    */
@@ -1464,7 +1427,7 @@ App.WizardStep8Controller = Em.Controller.extend({
     var mrProperties = {};
     configs.forEach(function (_configProperty) {
       mrProperties[_configProperty.name] = _configProperty.value;
-      this._recordHostOverrideFromObj(_configProperty, 'mapred-site', 'version1', this);
+      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);
     }, this);
@@ -1576,32 +1539,6 @@ App.WizardStep8Controller = Em.Controller.extend({
     return {type: 'webhcat-site', tag: 'version1', properties: webHCatProperties};
   },
 
-  getConfigForService: function (serviceName) {
-    switch (serviceName) {
-      case 'HDFS':
-        return {config: {'global': 'version1', 'core-site': 'version1', 'hdfs-site': 'version1'}};
-      case 'MAPREDUCE':
-        return {config: {'global': 'version1', 'core-site': 'version1', 'mapred-site': 'version1', 'capacity-scheduler': 'version1', 'mapred-queue-acls': 'version1'}};
-      case 'MAPREDUCE2':
-        return {config: {'global': 'version1', 'core-site': 'version1', 'mapred-site': 'version1', 'mapred-queue-acls': 'version1'}};
-      case 'YARN':
-        return {config: {'global': 'version1', 'yarn-site': 'version1', 'capacity-scheduler': 'version1'}};
-      case 'HBASE':
-        return {config: {'global': 'version1', 'hbase-site': 'version1'}};
-      case 'OOZIE':
-        return {config: {'global': 'version1', 'oozie-site': 'version1'}};
-      case 'HIVE':
-        return {config: {'global': 'version1', 'hive-site': 'version1'}};
-      case 'WEBHCAT':
-        return {config: {'global': 'version1', 'webhcat-site': 'version1'}};
-      case 'HUE':
-        return {config: {'global': 'version1', 'hue-site': 'version1'}};
-      default:
-        return {config: {'global': 'version1'}};
-    }
-  },
-
-
   ajaxQueueFinished: function () {
     //do something
   },

+ 0 - 108
ambari-web/app/data/config_properties.js

@@ -882,114 +882,6 @@ module.exports =
       "category": "CapacityScheduler",
       "filename": "capacity-scheduler.xml"
     },
-    /*{
-     "id": "site property",
-     "name": "mapred.cluster.map.memory.mb",
-     "displayName": "Map slot memory",
-     "displayType": "int",
-     "value": '-1',
-     "defaultValue": '-1',
-     "description": "The size, in terms of virtual memory, of a single map slot in the Map-Reduce framework, used by " +
-     "the scheduler. A job can ask for multiple slots for a single map task via \"Map task memory\", upto the limit " +
-     "specified by \"Max map task memory\", if the scheduler supports the feature. The value of -1 indicates that " +
-     "this feature is turned off.",
-     "isVisible": true,
-     "isRequired": true,
-     "serviceName": "MAPREDUCE",
-     "category": "CapacityScheduler",
-     "unit":"MB",
-     "filename": 'capacity-scheduler.xml'
-     },
-     {
-     "id": "site property",
-     "name": "mapred.cluster.reduce.memory.mb",
-     "displayName": "Reduce slot memory",
-     "displayType": "int",
-     "value": '-1',
-     "defaultValue": '-1',
-     "description": "The size, in terms of virtual memory, of a single reduce slot in the Map-Reduce framework, " +
-     "used by the scheduler. A job can ask for multiple slots for a single reduce task via \"Reduce task memory\", " +
-     "upto the limit specified by \"Max reduce task memory\", if the scheduler supports the feature.The value of " +
-     "-1 indicates that this feature is turned off.",
-     "isVisible": true,
-     "isRequired": true,
-     "serviceName": "MAPREDUCE",
-     "category": "CapacityScheduler",
-     "unit":"MB",
-     "filename": 'capacity-scheduler.xml'
-     },
-     {
-     "id": "site property",
-     "name": "mapred.cluster.max.map.memory.mb",
-     "displayName": "Max map task memory",
-     "displayType": "int",
-     "value": '-1',
-     "defaultValue": '-1',
-     "description": "The maximum size, in terms of virtual memory, of a single map task launched by the Map-Reduce " +
-     "framework, used by the scheduler. A job can ask for multiple slots for a single map task via " +
-     "\"Map task memory\", upto the limit specified by \"Max map task memory\", if the scheduler supports the " +
-     "feature. The value of -1 indicates that this feature is turned off.",
-     "isVisible": true,
-     "isRequired": true,
-     "serviceName": "MAPREDUCE",
-     "category": "CapacityScheduler",
-     "unit":"MB",
-     "filename": 'capacity-scheduler.xml'
-     },
-     {
-     "id": "site property",
-     "name": "mapred.cluster.max.reduce.memory.mb",
-     "displayName": "Max reduce task memory",
-     "displayType": "int",
-     "value": '-1',
-     "defaultValue": '-1',
-     "description": "The maximum size, in terms of virtual memory, of a single reduce task launched by the Map-Reduce " +
-     "framework, used by the scheduler. A job can ask for multiple slots for a single reduce task via \"Reduce task " +
-     "memory\", upto the limit specified by \"Max reduce task memory\", if the scheduler supports the feature. " +
-     "The value of -1 indicates that this feature is turned off.",
-     "isVisible": true,
-     "isRequired": true,
-     "serviceName": "MAPREDUCE",
-     "category": "CapacityScheduler",
-     "unit":"MB",
-     "filename": 'capacity-scheduler.xml'
-     },
-     {
-     "id": "site property",
-     "name": "mapred.job.map.memory.mb",
-     "displayName": "Map task memory",
-     "displayType": "int",
-     "value": '-1',
-     "defaultValue": '-1',
-     "description": "The size, in terms of virtual memory, of a single map task for the job. A job can ask for " +
-     "multiple slots for a single map task, rounded up to the next multiple of \"Map slot memory\" and upto " +
-     "the limit specified by \"Max map task memory\", if the scheduler supports the feature. The value of -1 " +
-     "indicates that this feature is turned off iff \"Map slot memory\" is also turned off.",
-     "isVisible": true,
-     "isRequired": true,
-     "serviceName": "MAPREDUCE",
-     "category": "CapacityScheduler",
-     "unit":"MB",
-     "filename": 'capacity-scheduler.xml'
-     },
-     {
-     "id": "site property",
-     "name": "mapred.job.reduce.memory.mb",
-     "displayName": "Reduce task memory",
-     "displayType": "int",
-     "value": '-1',
-     "defaultValue": '-1',
-     "description": "The size, in terms of virtual memory, of a single reduce task for the job. A job can ask for " +
-     "multiple slots for a single reduce task, rounded up to the next multiple of \"Reduce slot memory\" and upto " +
-     "the limit specified by \"Max reduce task memory\", if the scheduler supports the feature. The value of -1 " +
-     "indicates that this feature is turned off iff \"Task slot memory\" is also turned off.",
-     "isVisible": true,
-     "isRequired": true,
-     "serviceName": "MAPREDUCE",
-     "category": "CapacityScheduler",
-     "unit":"MB",
-     "filename": 'capacity-scheduler.xml'
-     },*/
   /**********************************************HBASE***************************************/
     {
       "id": "puppet var",

+ 15 - 16
ambari-web/app/data/service_configs.js

@@ -19,7 +19,6 @@
 var App = require('app');
 require('models/service_config');
 
-var configProperties = App.ConfigProperties.create();
 
 module.exports = [
   {
@@ -36,7 +35,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedHDFSSite', displayName : 'Custom hdfs-site.xml', siteFileName: 'hdfs-site.xml', canAddProperty: true})
     ],
     sites: ['global', 'core-site', 'hdfs-site'],
-    configs: configProperties.filterProperty('serviceName', 'HDFS')
+    configs: []
   },
 
   {
@@ -52,7 +51,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName : 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true})
     ],
     sites: ['global', 'core-site', 'mapred-site', 'capacity-scheduler', 'mapred-queue-acls'],
-    configs: configProperties.filterProperty('serviceName', 'MAPREDUCE')
+    configs: []
   },
 
   {
@@ -66,7 +65,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName : 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true})
     ],
     sites: ['core-site', 'mapred-site', 'mapred-queue-acls'],
-    configs: configProperties.filterProperty('serviceName', 'MAPREDUCE2')
+    configs: []
   },
 
   {
@@ -74,15 +73,15 @@ module.exports = [
     displayName: 'YARN',
     filename: 'yarn-site',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
-      App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
       App.ServiceConfigCategory.create({ name: 'ResourceManager', displayName : 'Resource Manager', hostComponentNames : ['RESOURCEMANAGER']}),
       App.ServiceConfigCategory.create({ name: 'NodeManager', displayName : 'Node Manager', hostComponentNames : ['NODEMANAGER']}),
+      App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
       App.ServiceConfigCategory.create({ name: 'CapacityScheduler', displayName : 'Capacity Scheduler', isCapacityScheduler : true, isCustomView: true, siteFileName: 'capacity-scheduler.xml', siteFileNames: ['capacity-scheduler.xml', 'mapred-queue-acls.xml'], canAddProperty: true}),
+      App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedYARNSite', displayName : 'Custom yarn-site.xml', siteFileName: 'yarn-site.xml', canAddProperty: true})
     ],
-    sites: ['core-site', 'yarn-site', 'capacity-scheduler'],
-    configs: configProperties.filterProperty('serviceName', 'MAPREDUCE2')
+    sites: ['core-site', 'yarn-site', 'capacity-scheduler', 'mapred-queue-acls'],
+    configs: []
   },
 
   {
@@ -95,7 +94,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedHiveSite', displayName : 'Custom hive-site.xml', siteFileName: 'hive-site.xml', canAddProperty: true})
     ],
     sites: ['global', 'hive-site'],
-    configs: configProperties.filterProperty('serviceName', 'HIVE')
+    configs: []
   },
 
   {
@@ -108,7 +107,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedWebHCatSite', displayName : 'Custom webhcat-site.xml', siteFileName: 'webhcat-site.xml', canAddProperty: true})
     ],
     sites: ['global', 'webhcat-site'],
-    configs: configProperties.filterProperty('serviceName', 'WEBHCAT')
+    configs: []
   },
 
   {
@@ -123,7 +122,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedHbaseSite', displayName : 'Custom hbase-site.xml', siteFileName: 'hbase-site.xml', canAddProperty: true})
     ],
     sites: ['global', 'hbase-site'],
-    configs: configProperties.filterProperty('serviceName', 'HBASE')
+    configs: []
   },
 
   {
@@ -134,7 +133,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'})
     ],
     sites: ['global'],
-    configs: configProperties.filterProperty('serviceName', 'ZOOKEEPER')
+    configs: []
   },
 
   {
@@ -147,7 +146,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'AdvancedOozieSite', displayName : 'Custom oozie-site.xml', siteFileName: 'oozie-site.xml', canAddProperty: true})
     ],
     sites: ['global', 'oozie-site'],
-    configs: configProperties.filterProperty('serviceName', 'OOZIE')
+    configs: []
   },
 
   {
@@ -157,7 +156,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'})
     ],
     sites: ['global'],
-    configs: configProperties.filterProperty('serviceName', 'NAGIOS')
+    configs: []
   },
 
   {
@@ -169,7 +168,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'})
     ],
     sites: ['hue-site'],
-    configs: configProperties.filterProperty('serviceName', 'HUE')
+    configs: []
   },
 
   {
@@ -180,7 +179,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Users and Groups', displayName : 'Users and Groups'})
     ],
     sites: ['global'],
-    configs: configProperties.filterProperty('serviceName', 'MISC')
+    configs: []
   }
 
 ];

+ 2 - 2
ambari-web/app/initialize.js

@@ -25,6 +25,7 @@ require('messages');
 require('utils/base64');
 require('utils/db');
 require('utils/helper');
+require('utils/config')
 require('models');
 require('controllers');
 require('templates');
@@ -32,8 +33,7 @@ require('views');
 require('router');
 
 require('utils/ajax');
-require('utils/updater');
-require('utils/config');
+require('utils/updater');;
 
 require('mappers/server_data_mapper');
 require('mappers/status_mapper');

+ 1 - 1
ambari-web/app/models/service.js

@@ -28,7 +28,7 @@ App.Service = DS.Model.extend({
   alerts: DS.hasMany('App.Alert'),
   quickLinks: DS.hasMany('App.QuickLinks'),
   hostComponents: DS.hasMany('App.HostComponent'),
-  serviceConfigsTemplate: require('data/service_configs'),
+  serviceConfigsTemplate: App.config.get('preDefinedServiceConfigs'),
   runningHostComponents: null,
   isStartDisabled: function () {
     return !(this.get('healthStatus') == 'red');

+ 0 - 1
ambari-web/app/routes/add_service_routes.js

@@ -165,7 +165,6 @@ module.exports = Em.Route.extend({
         addServiceController.saveSlaveComponentHosts(wizardStep6Controller);
         addServiceController.get('content').set('serviceConfigProperties', null);
         App.db.setServiceConfigProperties(null);
-        App.db.setSlaveProperties(null);
         addServiceController.loadAdvancedConfigs();
         router.transitionTo('step4');
       }

+ 1 - 1
ambari-web/app/routes/installer.js

@@ -258,7 +258,7 @@ module.exports = Em.Route.extend({
         controller.saveSlaveComponentHosts(wizardStep6Controller);
         controller.get('content').set('serviceConfigProperties', null);
         App.db.setServiceConfigProperties(null);
-        App.db.setSlaveProperties(null);
+        App.db.setAdvancedServiceConfig(null);
         controller.loadAdvancedConfigs();
         router.transitionTo('step7');
       }

+ 0 - 11
ambari-web/app/utils/db.js

@@ -186,12 +186,6 @@ App.db.setSlaveComponentHosts = function (slaveComponentHosts) {
   localStorage.setObject('ambari', App.db.data);
 };
 
-App.db.setSlaveProperties = function (slaveProperties) {
-  App.db.data = localStorage.getObject('ambari');
-  App.db.data.Installer.slaveProperties = slaveProperties;
-  localStorage.setObject('ambari', App.db.data);
-};
-
 App.db.setServiceConfigs = function (serviceConfigs) {
   App.db.data = localStorage.getObject('ambari');
   App.db.data.Installer.serviceConfigs = serviceConfigs;
@@ -390,11 +384,6 @@ App.db.getServiceConfigProperties = function () {
   return App.db.data.Installer.configProperties;
 };
 
-App.db.getSlaveProperties = function () {
-  App.db.data = localStorage.getObject('ambari');
-  return App.db.data.Installer.slaveProperties;
-};
-
 App.db.getCluster = function () {
   console.log('TRACE: Entering db:getClusterStatus function');
   App.db.data = localStorage.getObject('ambari');

+ 1 - 1
ambari-web/app/views/common/configs/services_config.js

@@ -213,7 +213,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
     serviceConfigObj.category = category.get('name');
 
     var serviceName = this.get('service.serviceName');
-    var serviceConfigsMetaData = require('data/service_configs');
+    var serviceConfigsMetaData = App.config.get('preDefinedServiceConfigs');
     var serviceConfigMetaData = serviceConfigsMetaData.findProperty('serviceName', serviceName);
     var categoryMetaData = serviceConfigMetaData == null ? null : serviceConfigMetaData.configCategories.findProperty('name', category.get('name'));
     if (categoryMetaData != null) {