Просмотр исходного кода

AMBARI-1004. Allow properties entered in custom config (ex: hdfs-site.xml) to override existing or create new properties. (Jaimin Jetly via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418924 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 лет назад
Родитель
Сommit
70be340448

+ 4 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,10 @@ AMBARI-666 branch (unreleased changes)
 
 
   NEW FEATURES
   NEW FEATURES
 
 
+  AMBARI-1004. Allow properties entered in custom config
+  (ex: hdfs-site.xml) to override existing or create new properties.
+  (Jaimin Jetly via yusaku)
+
   AMBARI-1002. Integrate Installer with config APIs. (Jaimin Jetly
   AMBARI-1002. Integrate Installer with config APIs. (Jaimin Jetly
   via yusaku)
   via yusaku)
 
 

+ 27 - 10
ambari-web/app/controllers/wizard/step8_controller.js

@@ -181,19 +181,36 @@ App.WizardStep8Controller = Em.Controller.extend({
   setCustomConfigs: function () {
   setCustomConfigs: function () {
     var site = this.get('content.serviceConfigProperties').filterProperty('id', 'conf-site');
     var site = this.get('content.serviceConfigProperties').filterProperty('id', 'conf-site');
     site.forEach(function (_site) {
     site.forEach(function (_site) {
-      var keys = _site.value.match(/[\s]*(\w*)=/g);
-      var configs = [];
-      if (keys) {
-        keys.forEach(function (_key) {
-          _key = _key.trim();
-          console.log("Value of key is: " + _key.substring(0, _key.length - 1));
-          var configKey = _key.substring(0, _key.length - 1);
-          if (configKey) {
-            configs.pushObject({key: configKey});
+      var keyValue = _site.value.split(/\n+/);
+      if (keyValue) {
+        keyValue.forEach(function (_keyValue) {
+          console.log("The value of the keyValue is: " + _keyValue.trim());
+          _keyValue = _keyValue.trim();
+          var key = _keyValue.match(/(.+)=/);
+          var value = _keyValue.match(/=(.*)/);
+          if (key) {
+            this.setSiteProperty(key[1], value[1],_site.filename);
           }
           }
+
         }, this);
         }, this);
       }
       }
-    }, this)
+    }, this);
+  },
+
+  /**
+   * Set property of the site variable
+   */
+  setSiteProperty: function(key,value,filename) {
+     if(this.get('configs').someProperty('name',key)) {
+       this.get('configs').findProperty('name',key).value = value;
+     } else {
+       this.get('configs').pushObject({
+         "id": "site property",
+         "name": key,
+         "value": value,
+         "filename": filename
+       });
+     }
   },
   },
 
 
   /**
   /**

+ 5 - 5
ambari-web/app/data/custom_configs.js

@@ -26,7 +26,7 @@ module.exports =
       "displayName": "Custom HDFS Configs",
       "displayName": "Custom HDFS Configs",
       "value": "",
       "value": "",
       "defaultValue": "",
       "defaultValue": "",
-      "description": "If you wish to set configuration parameters not exposed through this page, you can specify them here.<br>The text you specify here will be injected into hdfs-site.xml verbatim.",
+      "description": "Enter in \"<key> = <value>\" format to set hdfs-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
       "displayType": "custom",
       "displayType": "custom",
       "isVisible": true,
       "isVisible": true,
       "isRequired": false,
       "isRequired": false,
@@ -39,7 +39,7 @@ module.exports =
       "displayName": "Custom MapReduce Configs",
       "displayName": "Custom MapReduce Configs",
       "value": "",
       "value": "",
       "defaultValue": "",
       "defaultValue": "",
-      "description": "If you wish to set configuration parameters not exposed through this page, you can specify them here.<br>The text you specify here will be injected into mapred-site.xml verbatim.",
+      "description": "Enter in \"<key> = <value>\" format to set mapred-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
       "displayType": "custom",
       "displayType": "custom",
       "isVisible": true,
       "isVisible": true,
       "isRequired": false,
       "isRequired": false,
@@ -50,7 +50,7 @@ module.exports =
       "id": "conf-site",
       "id": "conf-site",
       "name": "hbase-site",
       "name": "hbase-site",
       "displayName": "Custom HBase Configs",
       "displayName": "Custom HBase Configs",
-      "description": "If you wish to set configuration parameters not exposed through this page, you can specify them here.<br>The text you specify here will be injected into hbase-site.xml verbatim.",
+      "description": "Enter in \"<key> = <value>\" format to set hbase-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
       "defaultValue": "",
       "defaultValue": "",
       "isRequired": false,
       "isRequired": false,
       "displayType": "custom",
       "displayType": "custom",
@@ -62,7 +62,7 @@ module.exports =
       "id": "conf-site",
       "id": "conf-site",
       "name": "hive-site",
       "name": "hive-site",
       "displayName": "Custom Hive Configs",
       "displayName": "Custom Hive Configs",
-      "description": "If you wish to set configuration parameters not exposed through this page, you can specify them here.<br>The text you specify here will be injected into hive-site.xml verbatim.",
+      "description": "Enter in \"<key> = <value>\" format to set hive-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
       "defaultValue": "",
       "defaultValue": "",
       "isRequired": false,
       "isRequired": false,
       "displayType": "custom",
       "displayType": "custom",
@@ -74,7 +74,7 @@ module.exports =
       "id": "conf-site",
       "id": "conf-site",
       "name": "oozie-site",
       "name": "oozie-site",
       "displayName": "Custom Oozie Configs",
       "displayName": "Custom Oozie Configs",
-      "description": "If you wish to set configuration parameters not exposed through this page, you can specify them here.<br>The text you specify here will be injected into oozie-site.xml verbatim.s",
+      "description": "Enter in \"<key> = <value>\" format to set oozie-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
       "defaultValue": "",
       "defaultValue": "",
       "isRequired": false,
       "isRequired": false,
       "displayType": "custom",
       "displayType": "custom",

+ 0 - 1
ambari-web/app/models/service_config.js

@@ -80,7 +80,6 @@ App.ServiceConfigProperty = Ember.Object.extend({
     switch (this.get('name')) {
     switch (this.get('name')) {
       case 'namenode_host':
       case 'namenode_host':
         var temp = masterComponentHostsInDB.findProperty('component', 'NAMENODE');
         var temp = masterComponentHostsInDB.findProperty('component', 'NAMENODE');
-        console.log("********The value of namemenode host is: " + temp.hostName);
         this.set('value', temp.hostName);
         this.set('value', temp.hostName);
         break;
         break;
       case 'snamenode_host':
       case 'snamenode_host':