瀏覽代碼

AMBARI-5473 Create configs tab for Flume service. (Buzhor Denys via ababiichuk)

aBabiichuk 11 年之前
父節點
當前提交
998ac11684

+ 29 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-agent.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<configuration>
+  <property>
+    <name>content</name>
+    <description>Flume agent config</description>
+    <value></value>
+  </property>
+</configuration>

+ 1 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/metainfo.xml

@@ -53,6 +53,7 @@
       </commandScript>
 
       <configuration-dependencies>
+        <config-type>flume-agent</config-type>
         <config-type>flume-conf</config-type>
         <config-type>flume-log4j</config-type>
         <config-type>global</config-type>

+ 6 - 0
ambari-web/app/assets/data/clusters/tags_and_groups.json

@@ -41,6 +41,12 @@
       "tez-site": {
         "tag": "version1"
       },
+      "flume-agent": {
+        "tag": "version1"
+      },
+      "flume-conf": {
+        "tag": "version1"
+      },
       "core-site" : {
         "tag" : "version1"
       }

+ 22 - 0
ambari-web/app/assets/data/configurations/cluster_level_configs.json

@@ -684,6 +684,28 @@
         "tez.staging-dir" : "/tmp/${user.name}/staging",
         "tez.task.get-task.sleep.interval-ms.max" : "100"
       }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/configurations?type=flume-agent&tag=version1",
+      "tag" : "version1",
+      "type" : "flume-agent",
+      "Config" : {
+        "cluster_name" : "c1"
+      },
+      "properties" : {
+        "content" : ""
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/configurations?type=flume-conf&tag=version1",
+      "tag" : "version1",
+      "type" : "flume-conf",
+      "Config" : {
+        "cluster_name" : "c1"
+      },
+      "properties" : {
+        "content" : "agent.sources = seqGenSrc\nagent.channels = memoryChannel\nagent.sinks = loggerSink\n"
+      }
     }
   ]
 }

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

@@ -737,7 +737,8 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
           domain: _configProperties.get('domain'),
           filename: _configProperties.get('filename'),
           displayType: _configProperties.get('displayType'),
-          isRequiredByAgent: _configProperties.get('isRequiredByAgent')
+          isRequiredByAgent: _configProperties.get('isRequiredByAgent'),
+          isCanBeEmpty: !!_configProperties.get('isCanBeEmpty') // flag that allow saving property with empty value
         };
         serviceConfigProperties.push(configProperty);
       }, this);

+ 8 - 21
ambari-web/app/controllers/wizard/step8_controller.js

@@ -351,7 +351,9 @@ App.WizardStep8Controller = Em.Controller.extend({
     serviceConfigProperties.forEach(function (_config) {
       _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
     });
-    var storedConfigs = serviceConfigProperties.filterProperty('value');
+    var storedConfigs = serviceConfigProperties.filter(function(configProperty) {
+      return !!configProperty.value || configProperty.isCanBeEmpty;
+    });
     var mappedConfigs = App.config.excludeUnsupportedConfigs(this.get('configMapping'), this.get('selectedServices').mapProperty('serviceName'));
     var uiConfigs = this.loadUiSideConfigs(mappedConfigs);
     this.set('configs', storedConfigs.concat(uiConfigs));
@@ -1336,7 +1338,10 @@ App.WizardStep8Controller = Em.Controller.extend({
         {filename: 'tez-site', isXmlFile: true}
       ], log4j: []},
       ZOOKEEPER: {site: [], log4j: ['zookeeper']},
-      FLUME: {site: [], log4j: []}
+      FLUME: {site: [
+        {filename: 'flume-agent', isXmlFile: false},
+        {filename: 'flume-conf', isXmlFile: false}
+      ], log4j: []}
     };
 
     if (App.supports.capacitySchedulerUi) {
@@ -1365,9 +1370,6 @@ App.WizardStep8Controller = Em.Controller.extend({
     if (selectedServices.someProperty('serviceName', 'ZOOKEEPER')) {
       this.get('serviceConfigTags').pushObject(this.createZooCfgObj());
     }
-    if (selectedServices.someProperty('serviceName', 'FLUME')) {
-      this.get('serviceConfigTags').pushObject(this.createFlumeConfObj());
-    }
   },
 
   /**
@@ -1607,21 +1609,6 @@ App.WizardStep8Controller = Em.Controller.extend({
     }, this);
     return {type: 'zoo.cfg', tag: 'version1', properties: csProperties};
   },
-
-  /**
-   * Create flume.conf Object
-   * @returns {{type: string, tag: string, properties: {}}}
-   * @method createFlumeConfObj
-   */
-  createFlumeConfObj: function () {
-    var configs = this.get('configs').filterProperty('filename', 'flume.conf');
-    var csProperties = {};
-    configs.forEach(function (_configProperty) {
-      csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
-    }, this);
-    return {type: 'flume.conf', tag: 'version1', properties: csProperties};
-  },
-
   /**
    * Create site obj for Storm
    * Some config-properties should be modified in custom way
@@ -1693,4 +1680,4 @@ App.WizardStep8Controller = Em.Controller.extend({
     App.router.get(this.get('content.controllerName')).setStepsEnable();
   }
 
-});
+});

+ 16 - 2
ambari-web/app/data/HDP2/site_properties.js

@@ -1659,8 +1659,22 @@ module.exports =
       "category": "AdvancedFlumeConf",
       "displayName": "content",
       "name": "content",
-      "displayType": "custom",
-      "filename": "flume.conf"
+      "isCanBeEmpty": true,
+      "displayType": "multiLine",
+      "filename": "flume-conf.xml"
+    },
+  /********************************************* flume-agent *****************************/
+    {
+      "id": "site property",
+      "name": "content",
+      "displayName": "content",
+      "showLabel": false,
+      "isRequired": false,
+      "displayType": "multiLine",
+      "serviceName": "FLUME",
+      "isCanBeEmpty": true,
+      "category": "FlumeAgent",
+      "filename": "flume-agent.xml"
     }
   ]
 };

+ 3 - 2
ambari-web/app/data/service_configs.js

@@ -283,9 +283,10 @@ module.exports = [
     serviceName: 'FLUME',
     displayName: 'Flume',
     configCategories: [
-      App.ServiceConfigCategory.create({ name: 'AdvancedFlumeConf', displayName : 'flume.conf', siteFileName: 'flume.conf', canAddProperty: false})
+      App.ServiceConfigCategory.create({ name: 'AdvancedFlumeConf', displayName : 'flume.conf', siteFileName: 'flume.conf', canAddProperty: false}),
+      App.ServiceConfigCategory.create({ name: 'FlumeAgent', displayName : 'flume-agent', siteFileName: 'flume-agent', canAddProperty: false})
     ],
-    sites: ['flume.conf'],
+    sites: ['flume-conf', 'flume-agent'],
     configs: []
   },
   {

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

@@ -89,7 +89,8 @@ App.Service = DS.Model.extend({
       "HUE",
       "TEZ",
       "STORM",
-      "FALCON"
+      "FALCON",
+      "FLUME"
     ];
     return configurableServices.contains(this.get('serviceName'));
   }.property('serviceName'),

+ 4 - 4
ambari-web/app/utils/config.js

@@ -109,14 +109,14 @@ App.config = Em.Object.create({
   categoriesWithCustom: ['CapacityScheduler'],
   //configs with these filenames go to appropriate category not in Advanced
   customFileNames: function () {
+    var customFiles = ['flume-conf.xml', 'flume-agent.xml'];
     if (App.supports.capacitySchedulerUi) {
       if (App.get('isHadoop2Stack')) {
-        return ['capacity-scheduler.xml'];
+        return customFiles.concat(['capacity-scheduler.xml']);
       }
-      return ['capacity-scheduler.xml', 'mapred-queue-acls.xml'];
-    } else {
-      return [];
+      return customFiles.concat(['capacity-scheduler.xml', 'mapred-queue-acls.xml']);
     }
+    return customFiles;
   }.property('App.isHadoop2Stack'),
 
   /**