ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: Revert "AMBARI-4762 Modify Config pages to store/retrieve custom log4j configs as raw text. (ababiichuk)"
Date Thu, 20 Feb 2014 22:56:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f02308fa1 -> eae58511e


Revert "AMBARI-4762 Modify Config pages to store/retrieve custom log4j configs as raw text.
(ababiichuk)"

This reverts commit f02308fa1773f020988617d7546a13293c2df33c.


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

Branch: refs/heads/trunk
Commit: eae58511e5732f235a10250ab6a9640c7fe25173
Parents: f02308f
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Thu Feb 20 14:56:19 2014 -0800
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Thu Feb 20 14:56:19 2014 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |   3 -
 .../app/controllers/wizard/step8_controller.js  |   6 +-
 ambari-web/app/data/HDP2/site_properties.js     | 138 +------------
 ambari-web/app/data/service_configs.js          |  28 +--
 ambari-web/app/utils/config.js                  | 198 ++++++-------------
 5 files changed, 73 insertions(+), 300 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/eae58511/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 7781677..18ce9db 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -353,9 +353,6 @@ App.WizardStep7Controller = Em.Controller.extend({
     if (this.get('allSelectedServiceNames').contains('YARN') && !App.supports.capacitySchedulerUi)
{
       configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml');
     }
-    this.get('allSelectedServiceNames').forEach(function(serviceName) {
-      App.config.addLog4jConfig(configs, serviceName);
-    });
     this.set('groupsToDelete', this.get('wizardController').getDBProperty('groupsToDelete')
|| []);
     var localDB = {
       hosts: this.get('wizardController').getDBProperty('hosts'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/eae58511/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 339ea2b..ab0f909 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1292,12 +1292,12 @@ App.WizardStep8Controller = Em.Controller.extend({
     return {"type": "hdfs-site", "tag": "version1", "properties": hdfsProperties };
   },
 
-  createLog4jObj: function (serviceName) {
-    var fileName = serviceName.toLowerCase();
+  createLog4jObj: function (fileName) {
+    fileName = fileName.toLowerCase();
     var Log4jObj = this.get('configs').filterProperty('filename', fileName + '-log4j.xml');
     var Log4jProperties = {};
     Log4jObj.forEach(function (_configProperty) {
-      Log4jProperties[_configProperty.name] = _configProperty.value;
+      Log4jProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
       this._recordHostOverrideFromObj(_configProperty, fileName + '-log4j', 'version1', this);
       console.log("STEP*: name of the property is: " + _configProperty.name);
       console.log("STEP8: value of the property is: " + _configProperty.value);

http://git-wip-us.apache.org/repos/asf/ambari/blob/eae58511/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js
index e189e8c..e5a6a04 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -1596,142 +1596,6 @@ module.exports =
       "displayType": "multiLine",
       "serviceName": "WEBHCAT",
       "category": "Advanced"
-   /**********************************************log4j.properties***************************************/
-    },
-    {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "HDFS",
-     "filename": "hdfs-log4j.xml",
-     "category": "AdvancedHDFSLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "MAPREDUCE2",
-     "filename": "mapreduce2-log4j.xml",
-     "category": "AdvancedMapredLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "YARN",
-     "filename": "yarn-log4j.xml",
-     "category": "AdvancedYARNLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "HBASE",
-     "filename": "hbase-log4j.xml",
-     "category": "AdvancedHbaseLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "HIVE",
-     "filename": "hive-exec-log4j.xml",
-     "category": "AdvancedHiveExecLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "HIVE",
-     "filename": "hive-log4j.xml",
-     "category": "AdvancedHiveLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "OOZIE",
-     "filename": "oozie-log4j.xml",
-     "category": "AdvancedOozieLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "ZOOKEEPER",
-     "filename": "zookeeper-log4j.xml",
-     "category": "AdvancedZooLog4j"
-     },
-     {
-     "id": "site property",
-     "name": "content",
-     "displayName": "content",
-     "value": "",
-     "defaultValue": "",
-     "description": "log4j properties",
-     "displayType": "custom",
-     "isOverridable": true,
-     "isRequired": false,
-     "isVisible": true,
-     "serviceName": "PIG",
-     "filename": "pig-log4j.xml",
-     "category": "AdvancedPigLog4j"
-     }
+    }
   ]
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/eae58511/ambari-web/app/data/service_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/service_configs.js b/ambari-web/app/data/service_configs.js
index 803d6df..5660782 100644
--- a/ambari-web/app/data/service_configs.js
+++ b/ambari-web/app/data/service_configs.js
@@ -37,7 +37,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedCoreSite', displayName : 'Custom
core-site.xml', siteFileName: 'core-site.xml', canAddProperty: true}),
       App.ServiceConfigCategory.create({ name: 'AdvancedHDFSSite', displayName : 'Custom
hdfs-site.xml', siteFileName: 'hdfs-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedHDFSLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'hdfs-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedHDFSLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'hdfs-log4j.xml', canAddProperty: true})
     ],
     sites: ['global', 'core-site', 'hdfs-site', 'hdfs-log4j'],
     configs: []
@@ -64,9 +64,9 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName : 'Custom
mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedMapredLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'mapreduce-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedMapredLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'mapred-log4j.xml', canAddProperty: true})
     ],
-    sites: ['global', 'mapred-site', 'mapred-queue-acls', 'mapreduce-log4j'],
+    sites: ['global', 'mapred-site', 'mapred-queue-acls', 'mapred-log4j'],
     configs: []
   },
 
@@ -84,7 +84,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'CapacityScheduler', displayName : 'Scheduler',
isCapacityScheduler : true, isCustomView: true, siteFileName: 'capacity-scheduler.xml', siteFileNames:
['capacity-scheduler.xml', 'mapred-queue-acls.xml'], canAddProperty: App.supports.capacitySchedulerUi}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedYARNSite', displayName : 'Custom
yarn-site.xml', siteFileName: 'yarn-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedYARNLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'yarn-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedYARNLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'yarn-log4j.xml', canAddProperty: true})
     ],
     sites: ['global', 'yarn-site', 'capacity-scheduler', 'yarn-log4j'],
     configs: []
@@ -101,9 +101,9 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName : 'Custom
mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedMapredLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'mapreduce2-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedMapredLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'mapred-log4j.xml', canAddProperty: true})
     ],
-    sites: ['global', 'mapred-site', 'mapred-queue-acls', 'mapreduce2-log4j'],
+    sites: ['global', 'mapred-site', 'mapred-queue-acls', 'mapred-log4j'],
     configs: []
   },
 
@@ -115,10 +115,10 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Hive Metastore', displayName : 'Hive Metastore'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedHiveSite', displayName : 'Custom
hive-site.xml', siteFileName: 'hive-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedHiveLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'hive-log4j.xml'}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedHiveExecLog4j', displayName : 'Custom
hive-exec-log4j', siteFileName: 'hive-exec-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedHiveLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'hive-log4j.xml', canAddProperty: true}),
+      App.ServiceConfigCategory.create({ name: 'AdvancedHiveExecLog4j', displayName : 'Custom
hive-exec-log4j', siteFileName: 'hive-exec-log4j.xml', canAddProperty: true})
     ],
-    sites: ['global', 'hive-site', 'hive-log4j', 'hive-exec-log4j'],
+    sites: ['global', 'hive-site', 'hive-log4j', 'hive-log4j-exec'],
     configs: []
   },
 
@@ -145,7 +145,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedHbaseSite', displayName : 'Custom
hbase-site.xml', siteFileName: 'hbase-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedHbaseLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'hbase-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedHbaseLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'hbase-log4j.xml', canAddProperty: true})
     ],
     sites: ['global', 'hbase-site', 'hbase-log4j'],
     configs: []
@@ -157,10 +157,10 @@ module.exports = [
     configCategories: [
       App.ServiceConfigCategory.create({ name: 'ZooKeeper Server', displayName : 'ZooKeeper
Server'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedZooLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'zookeeper-log4j.xml'}),
+      App.ServiceConfigCategory.create({ name: 'AdvancedZooLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'zoo-log4j.xml', canAddProperty: true}),
       App.ServiceConfigCategory.create({ name: 'AdvancedZooCfg', displayName : 'Custom zoo.cfg',
siteFileName: 'zoo.cfg', canAddProperty: true})
     ],
-    sites: ['global', 'zookeeper-log4j', 'zoo.cfg'],
+    sites: ['global', 'zoo-log4j', 'zoo.cfg'],
     configs: []
   },
 
@@ -172,7 +172,7 @@ module.exports = [
       App.ServiceConfigCategory.create({ name: 'Oozie Server', displayName : 'Oozie Server'}),
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
       App.ServiceConfigCategory.create({ name: 'AdvancedOozieSite', displayName : 'Custom
oozie-site.xml', siteFileName: 'oozie-site.xml', canAddProperty: true}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedOozieLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'oozie-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedOozieLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'oozie-log4j.xml', canAddProperty: true})
     ],
     sites: ['global', 'oozie-site', 'oozie-log4j'],
     configs: []
@@ -215,7 +215,7 @@ module.exports = [
     displayName: 'Pig',
     configCategories: [
       App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
-      App.ServiceConfigCategory.create({ name: 'AdvancedPigLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'pig-log4j.xml'})
+      App.ServiceConfigCategory.create({ name: 'AdvancedPigLog4j', displayName : 'Custom
log4j.properties', siteFileName: 'pig-log4j.xml', canAddProperty: true})
     ],
     sites: ['pig-log4j'],
     configs: []

http://git-wip-us.apache.org/repos/asf/ambari/blob/eae58511/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 5f5f9cb..7bfe7cb 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -19,7 +19,6 @@
 var App = require('app');
 var stringUtils = require('utils/string_utils');
 
-var categotyConfigs = require('data/service_configs');
 var serviceComponents = {};
 var configGroupsByTag = [];
 
@@ -50,11 +49,6 @@ App.config = Em.Object.create({
    */
   filenameExceptions: ['zoo.cfg'],
 
-  log4jNotDefaultFilenames: [
-    {serviceName: 'HIVE', tagName: 'hive-exec-log4j.xml', configCroupName: 'AdvancedHiveExecLog4j',
fileName:  'hive-exec-log4j.properties'},
-    {serviceName: 'HIVE', tagName: 'hive-log4j.xml', configCroupName: 'AdvancedHiveLog4j',
fileName:  'hive-log4j.properties'}
-  ],
-
   /**
    * Since values end up in XML files (core-sit.xml, etc.), certain
    * XML sensitive characters should be escaped. If not we will have
@@ -251,7 +245,7 @@ App.config = Em.Object.create({
       properties = (properties.length) ? properties.objectAt(0).properties : {};
       for (var index in properties) {
         var configsPropertyDef =  null;
-        var preDefinedConfig = preDefinedConfigs.filterProperty('serviceName',serviceName).filterProperty('name',
index);
+        var preDefinedConfig = preDefinedConfigs.filterProperty('name', index);
         preDefinedConfig.forEach(function(_preDefinedConfig){
           if (selectedServiceNames.contains(_preDefinedConfig.serviceName) || _preDefinedConfig.serviceName
=== 'MISC') {
             configsPropertyDef = _preDefinedConfig;
@@ -364,15 +358,10 @@ App.config = Em.Object.create({
     }, this);
 
     this.get('preDefinedSiteProperties').mapProperty('name').forEach(function (name) {
-      var _site = siteConfigs.filterProperty('name', name);
-      if (_site.length == 1) {
-        siteStart.push(_site[0]);
-        siteConfigs = siteConfigs.without(_site[0]);
-      } else if (_site.length >1) {
-        _site.forEach(function(site){
-          siteStart.push(site);
-          siteConfigs = siteConfigs.without(site);
-        }, this);
+      var _site = siteConfigs.findProperty('name', name);
+      if (_site) {
+        siteStart.push(_site);
+        siteConfigs = siteConfigs.without(_site);
       }
     }, this);
 
@@ -399,87 +388,69 @@ App.config = Em.Object.create({
   mergePreDefinedWithStored: function (storedConfigs, advancedConfigs, selectedServiceNames)
{
     var mergedConfigs = [];
     var preDefinedConfigs = $.extend(true, [], this.get('preDefinedGlobalProperties').concat(this.get('preDefinedSiteProperties')));
-
+    var categoryMetaData = null;
     storedConfigs = (storedConfigs) ? storedConfigs : [];
 
     var preDefinedNames = preDefinedConfigs.mapProperty('name');
     var storedNames = storedConfigs.mapProperty('name');
     var names = preDefinedNames.concat(storedNames).uniq();
     names.forEach(function (name) {
-      var storedCfgs = storedConfigs.filterProperty('name', name);
-      var preDefinedCfgs = [];
+      var stored = storedConfigs.findProperty('name', name);
+      var preDefined;
       var preDefinedConfig = preDefinedConfigs.filterProperty('name', name);
-      preDefinedConfig.forEach(function (_preDefinedConfig) {
-        if (selectedServiceNames.contains(_preDefinedConfig.serviceName) || _preDefinedConfig.serviceName
=== 'MISC') {
-          preDefinedCfgs.push(_preDefinedConfig);
-        }
-      }, this);
+         preDefinedConfig.forEach(function(_preDefinedConfig){
+           if (selectedServiceNames.contains(_preDefinedConfig.serviceName) || _preDefinedConfig.serviceName
=== 'MISC') {
+             preDefined = _preDefinedConfig;
+           }
+         },this);
 
       var configData = {};
-      if (storedCfgs.length == 1 && preDefinedCfgs.length == 1) {
-        var stored = storedCfgs[0];
-        var preDefined = preDefinedCfgs[0];
-        var isAdvanced = advancedConfigs.someProperty('name', name);
-        if (preDefined && stored) {
-          configData = preDefined;
-          configData.value = stored.value;
-          configData.defaultValue = stored.defaultValue;
-          configData.overrides = stored.overrides;
-          configData.filename = stored.filename;
-          configData.description = stored.description;
-          configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent
: true;
-        } else if (!preDefined && stored) {
+      var isAdvanced = advancedConfigs.someProperty('name', name);
+      if (preDefined && stored) {
+        configData = preDefined;
+        configData.value = stored.value;
+        configData.defaultValue = stored.defaultValue;
+        configData.overrides = stored.overrides;
+        configData.filename = stored.filename;
+        configData.description = stored.description;
+        configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent
: true;
+      } 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
-          };
-          this.calculateConfigProperties(configData, isAdvanced, advancedConfigs);
-        } else if (preDefined && !stored) {
-          configData = preDefined;
-          configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent
: true;
-          if (isAdvanced) {
-            var advanced = advancedConfigs.findProperty('name', configData.name);
-            // Password fields should be made blank by default in installer wizard
-            // irrespective of whatever value is sent from stack definition.
-            // This forces the user to fill the password field.
-            configData.value = configData.displayType == "password" ? '' : advanced.value;
-            configData.defaultValue = configData.value;
-            configData.filename = advanced.filename;
-            configData.description = advanced.description;
-          }
-        }
-        if (configData.displayType === 'checkbox') {
-          configData.value = configData.value === 'true'; // convert {String} value to {Boolean}
+        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
+        };
+        this.calculateConfigProperties(configData, isAdvanced, advancedConfigs);
+      } else if (preDefined && !stored) {
+        configData = preDefined;
+        configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent
: true;
+        if (isAdvanced) {
+          var advanced = advancedConfigs.findProperty('name', configData.name);
+          // Password fields should be made blank by default in installer wizard
+          // irrespective of whatever value is sent from stack definition.
+          // This forces the user to fill the password field.
+          configData.value = configData.displayType == "password" ? '' : advanced.value;
           configData.defaultValue = configData.value;
+          configData.filename = advanced.filename;
+          configData.description = advanced.description;
         }
-        mergedConfigs.push(configData);
-      } else {
-        preDefinedCfgs.forEach(function (cfg) {
-          configData = cfg;
-          var storedCfg = storedCfgs.findProperty('filename', cfg.filename);
-          if (storedCfg) {
-            configData.value = storedCfg.value;
-            configData.defaultValue = storedCfg.defaultValue;
-            configData.overrides = storedCfg.overrides;
-            configData.filename = storedCfg.filename;
-            configData.description = storedCfg.description;
-            configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ?
configData.isRequiredByAgent : true;
-          }
-          mergedConfigs.push(configData);
-        }, this);
       }
+      if (configData.displayType === 'checkbox') {
+        configData.value = configData.value === 'true'; // convert {String} value to {Boolean}
+        configData.defaultValue = configData.value;
+      }
+      mergedConfigs.push(configData);
     }, this);
     return mergedConfigs;
   },
@@ -984,65 +955,6 @@ App.config = Em.Object.create({
     return configs;
   },
 
-
-  addLog4jConfig: function (configs, serviceName) {
-    var fileName = serviceName.toLowerCase() + '-log4j.xml';
-    var content = configs.filterProperty('serviceName', serviceName).findProperty('name',
'content');
-    if (!content || !content.value.length) {
-      var category = categotyConfigs.findProperty('serviceName', serviceName) &&
categotyConfigs.findProperty('serviceName', serviceName).configCategories.findProperty('siteFileName',
fileName);
-      if (category) {
-        if (serviceName == 'HIVE') {
-          this.get('log4jNotDefaultFilenames').forEach(function (info) {
-            this.loadLog4jDefaultProperties(configs, 'HIVE', info.tagName, info.configCroupName,
info.fileName);
-          }, this);
-        } else {
-          this.loadLog4jDefaultProperties(configs, serviceName, category.siteFileName, category.name);
-        }
-      }
-    }
-    /**
-     * Filtering properties to exclude {serviceName}-log4j.xml file. We don't use properties
from this file,
-     * instead we load log4j.properties file as one property named "content".
-     * Filter can be deleted after {serviceName}-log4j.xml will be deleted from server
-     */
-    return configs.filter(function (_config) {
-      return (_config.filename !== fileName || _config.name == "content");
-    });
-  },
-
-  loadLog4jDefaultProperties: function(configs, serviceName, fileName, categoryName, log4jFile)
{
-    var url = "/resources//stacks/HDP/" + App.get('currentStackVersionNumber') + "/services/"
+ serviceName + "/configuration/" + (log4jFile || "log4j.properties");
-    $.ajax({
-      type: "GET",
-      url: url,
-      async: false,
-      success: function(data) {
-        var log4jObj = new Object({
-          "id": "puppet var",
-          "name": "content",
-          "displayName": "content",
-          "value": data,
-          "defaultValue": data,
-          "description": "log4j properties",
-          "displayType": "custom",
-          "isOverridable": true,
-          "isRequired": true,
-          "isVisible": true,
-          "serviceName": serviceName,
-          "filename": fileName,
-          "category": categoryName
-        });
-        var cfg = configs.findProperty('filename',fileName);
-        if (!cfg) {
-          configs.push(log4jObj);
-        } else {
-          cfg.value = data;
-          cfg.defaultValue = data;
-        }
-      }
-    });
-  },
-
   /**
    * trim trailing spaces for all properties.
    * trim both trailing and leading spaces for host displayType and hive/oozie datebases
url.


Mime
View raw message