Browse Source

AMBARI-4117. hbase.zookeeper.quorum and templeton.zookeeper.hosts properties should be surfaced on web-ui. (jaimin)

Jaimin Jetly 11 years ago
parent
commit
778edc8dc4

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

@@ -1270,25 +1270,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   },
 
   _replaceConfigValues: function (name, express, value, globValue) {
-    if (name === "templeton.zookeeper.hosts" || name === 'hbase.zookeeper.quorum') {
-      var zooKeeperPort = '2181';
-      if (typeof globValue === 'string') {
-        var temp = [];
-        temp.push(globValue);
-        globValue = temp;
-      }
-      if (name === "templeton.zookeeper.hosts") {
-        var temp = [];
-        globValue.forEach(function (_host, index) {
-          temp.push(globValue[index] + ':' + zooKeeperPort);
-        }, this);
-        globValue = temp;
-      }
-      value = value.replace(express, globValue.toString());
-    } else {
-      value = value.replace(express, globValue);
-    }
-    return value;
+    return value.replace(express, globValue);
   },
 
   /**

+ 1 - 15
ambari-web/app/controllers/wizard/step8_controller.js

@@ -320,21 +320,7 @@ App.WizardStep8Controller = Em.Controller.extend({
   },
 
   _replaceConfigValues: function (name, express, value, globValue) {
-    if (name === "templeton.zookeeper.hosts" || name === 'hbase.zookeeper.quorum') {
-      // globValue is an array of ZooKeeper Server hosts
-      var zooKeeperPort = '2181';
-      if (name === "templeton.zookeeper.hosts") {
-        var zooKeeperServers = globValue.map(function (item) {
-          return item + ':' + zooKeeperPort;
-        }).join(',');
-        value = value.replace(express, zooKeeperServers);
-      } else {
-        value = value.replace(express, globValue.join(','));
-      }
-    } else {
-      value = value.replace(express, globValue);
-    }
-    return value;
+    return value.replace(express, globValue);
   },
 
   /**

+ 2 - 18
ambari-web/app/data/HDP2/config_mapping.js

@@ -97,27 +97,11 @@ var configs = [
     "filename": "core-site.xml"
   },
   {
-        "name": "fs.AbstractFileSystem.glusterfs.impl",
-        "templateName": ["fs_AbstractFileSystem_glusterfs_impl"],
+    "name": "fs.AbstractFileSystem.glusterfs.impl",
+    "templateName": ["fs_AbstractFileSystem_glusterfs_impl"],
     "foreignKey": null,
     "value": "<templateName[0]>",
     "filename": "core-site.xml"
-  },
-/**********************************************hbase-site***************************************/
-  {
-    "name": "hbase.zookeeper.quorum",
-    "templateName": ["zookeeperserver_hosts"],
-    "foreignKey": null,
-    "value": "<templateName[0]>",
-    "filename": "hbase-site.xml"
-  },
-/**********************************************webhcat-site***************************************/
-  {
-    "name": "templeton.zookeeper.hosts",
-    "templateName": ["zookeeperserver_hosts"],
-    "foreignKey": null,
-    "value": "<templateName[0]>",
-    "filename": "webhcat-site.xml"
   }
 ];
 

+ 20 - 0
ambari-web/app/data/HDP2/site_properties.js

@@ -683,6 +683,26 @@ module.exports =
       "category": "General",
       "serviceName": "HBASE",
       "index": 5
+    },
+    {
+      "id": "site property",
+      "name": "hbase.zookeeper.quorum",
+      "displayName": "hbase.zookeeper.quorum",
+      "defaultValue": "",
+      "displayType": "multiLine",
+      "serviceName": "HBASE",
+      "category": "Advanced"
+    },
+
+  /**********************************************webhcat-site***************************************/
+    {
+      "id": "site property",
+      "name": "templeton.zookeeper.hosts",
+      "displayName": "templeton.zookeeper.hosts",
+      "defaultValue": "",
+      "displayType": "multiLine",
+      "serviceName": "WEBHCAT",
+      "category": "Advanced"
     }
   ]
 };

+ 0 - 19
ambari-web/app/data/config_mapping.js

@@ -67,25 +67,6 @@ var configs = [
     "isOverridable" : true
   },
 
-/**********************************************hbase-site***************************************/
-  {
-    "name": "hbase.zookeeper.quorum",
-    "templateName": ["zookeeperserver_hosts"],
-    "foreignKey": null,
-    "value": "<templateName[0]>",
-    "filename": "hbase-site.xml"
-  },
-
-/**********************************************webhcat-site***************************************/
-
-  {
-    "name": "templeton.zookeeper.hosts",
-    "templateName": ["zookeeperserver_hosts"],
-    "foreignKey": null,
-    "value": "<templateName[0]>",
-    "filename": "webhcat-site.xml"
-  },
-
 /**********************************************core-site for glusterfs***************************************/
   {
     "name": "fs.glusterfs.impl",

+ 20 - 0
ambari-web/app/data/site_properties.js

@@ -690,6 +690,26 @@ module.exports =
       "displayType": "checkbox",
       "serviceName": "HBASE",
       "category": "Advanced"
+    },
+    {
+      "id": "site property",
+      "name": "hbase.zookeeper.quorum",
+      "displayName": "hbase.zookeeper.quorum",
+      "defaultValue": "",
+      "displayType": "multiLine",
+      "serviceName": "HBASE",
+      "category": "Advanced"
+    },
+
+  /**********************************************webhcat-site***************************************/
+    {
+      "id": "site property",
+      "name": "templeton.zookeeper.hosts",
+      "displayName": "templeton.zookeeper.hosts",
+      "defaultValue": "",
+      "displayType": "multiLine",
+      "serviceName": "WEBHCAT",
+      "category": "Advanced"
     }
   ]
 };

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

@@ -394,6 +394,22 @@ App.ServiceConfigProperty = Ember.Object.extend({
       case 'zookeeperserver_hosts':
         this.set('value', masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName'));
         break;
+      case 'hbase.zookeeper.quorum':
+        var zkHosts = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
+        this.setDefaultValue("(\\w*)", zkHosts);
+        break;
+      case 'templeton.zookeeper.hosts':
+        var zkHosts = masterComponentHostsInDB.filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
+        var zkHostPort = zkHosts;
+        var regex = "\\w*:(\\d+)";   //regex to fetch the port
+        var portValue = this.get('defaultValue').match(new RegExp(regex));
+        if (portValue[1]) {
+          for ( var i = 0; i < zkHosts.length; i++ ) {
+            zkHostPort[i] = zkHosts[i] + ":" + portValue[1];
+          }
+        }
+        this.setDefaultValue("(.*)", zkHostPort);
+        break;
       case 'dfs.name.dir':
       case 'dfs.namenode.name.dir':
       case 'dfs.data.dir':