Ver código fonte

AMBARI-10623 Mysterious "nfs.dump.dir" and "nfs.exports.allowed.hosts" warnings occur for HDFS. (ababiichuk)

aBabiichuk 10 anos atrás
pai
commit
766cb64ef5

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

@@ -119,6 +119,9 @@ var hdp2properties = [
     "category": "NFS_GATEWAY",
     "serviceName": "HDFS",
     "filename": "hdfs-site.xml",
+    "stack": {
+      "HDP": "2.3"
+    },
     "index": 1
   },
   {
@@ -141,6 +144,9 @@ var hdp2properties = [
     "category": "NFS_GATEWAY",
     "serviceName": "HDFS",
     "filename": "hdfs-site.xml",
+    "stack": {
+      "HDP": "2.3"
+    },
     "index": 3
   },
   {

+ 11 - 2
ambari-web/app/utils/config.js

@@ -112,6 +112,8 @@ App.config = Em.Object.create({
 
   preDefinedSiteProperties: function () {
     var sitePropertiesForCurrentStack = this.preDefinedConfigFile('site_properties');
+    // default is HDP2
+    var configProperties = require('data/HDP2/site_properties').configProperties;
     if (sitePropertiesForCurrentStack) {
       return sitePropertiesForCurrentStack.configProperties;
     }
@@ -120,9 +122,16 @@ App.config = Em.Object.create({
       return require('data/HDP2.3/site_properties').configProperties;
     }
     if (App.get('isHadoop22Stack')) {
-      return require('data/HDP2.2/site_properties').configProperties;
+      configProperties = require('data/HDP2.2/site_properties').configProperties;
     }
-    return require('data/HDP2/site_properties').configProperties;
+    // filter config properties by stack name and version if defined
+    return configProperties.filter(function(item) {
+      if (item.stack) {
+        var stackVersion = item.stack[App.get('currentStackName')];
+        return stackVersion && stringUtils.compareVersions(App.get('currentStackVersionNumber'), stackVersion) > -1;
+      }
+      return true;
+    });
   }.property('App.isHadoop22Stack', 'App.isHadoop23Stack', 'App.currentStackName'),
 
   preDefinedConfigFile: function(file) {

+ 15 - 0
ambari-web/test/utils/config_test.js

@@ -395,6 +395,21 @@ describe('App.config', function () {
     });
   });
 
+  describe('#preDefinedSiteProperties-stack-attribute', function() {
+    var HDP23Only = ['nfs.dump.dir', 'nfs.exports.allowed.hosts'];
+    it('should ignore properties that not belongs to stack HDP - 2.2', function() {
+      setups.setupStackVersion(this, 'HDP-2.2');
+      expect(App.config.get('preDefinedSiteProperties').mapProperty('name')).to.not.include.members(HDP23Only);
+      setups.restoreStackVersion(this);
+    });
+
+    it('properties related to HDP-2.3 stack only should be present', function() {
+      setups.setupStackVersion(this, 'HDP-2.3');
+      expect(App.config.get('preDefinedSiteProperties').mapProperty('name')).to.include.members(HDP23Only);
+      setups.restoreStackVersion(this);
+    });
+  });
+
   describe('#generateConfigPropertiesByName', function() {
     var tests = [
       {