Browse Source

AMBARI-15973 FE is auto-populating hive.metastore.uris for hive-interactive-site. (ababiichuk)

ababiichuk 9 years ago
parent
commit
92b11fc48e

+ 5 - 3
ambari-web/app/utils/configs/config_initializer.js

@@ -303,9 +303,11 @@ App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedIn
    * @private
    */
   _initHiveMetastoreUris: function (configProperty, localDB, dependencies) {
-    var hiveMSUris = this.getHiveMetastoreUris(localDB.masterComponentHosts, dependencies['hive.metastore.uris']);
-    if (hiveMSUris) {
-      this.setRecommendedValue(configProperty, "(.*)", hiveMSUris);
+    if (App.config.getConfigTagFromFileName(Em.get(configProperty, 'filename')) === 'hive-site') {
+      var hiveMSUris = this.getHiveMetastoreUris(localDB.masterComponentHosts, dependencies['hive.metastore.uris']);
+      if (hiveMSUris) {
+        this.setRecommendedValue(configProperty, "(.*)", hiveMSUris);
+      }
     }
     return configProperty;
   },

+ 10 - 8
ambari-web/app/utils/configs/move_hm_config_initializer.js

@@ -48,18 +48,20 @@ App.MoveHmConfigInitializer = App.MoveHiveComponentConfigInitializerClass.create
    * @method _initHiveMetastoreUris
    */
   _initHiveMetastoreUris: function (configProperty, localDB, dependencies) {
-    var hiveMSHosts = this.__getHmHostsConsideringMoved(localDB, dependencies);
+    if (App.config.getConfigTagFromFileName(Em.get(configProperty, 'filename')) === 'hive-site') {
+      var hiveMSHosts = this.__getHmHostsConsideringMoved(localDB, dependencies);
 
-    var value = Em.get(configProperty, 'value');
+      var value = Em.get(configProperty, 'value');
 
-    var port = value.match(/:[0-9]{2,4}/);
-    port = port ? port[0].slice(1) : '9083';
+      var port = value.match(/:[0-9]{2,4}/);
+      port = port ? port[0].slice(1) : '9083';
 
-    value = hiveMSHosts.uniq().map(function (hiveMSHost) {
-      return 'thrift://' + hiveMSHost + ':' + port;
-    }).join(',');
+      value = hiveMSHosts.uniq().map(function (hiveMSHost) {
+        return 'thrift://' + hiveMSHost + ':' + port;
+      }).join(',');
 
-    Em.set(configProperty, 'value', value);
+      Em.set(configProperty, 'value', value);
+    }
     return configProperty;
   },
 

+ 4 - 1
ambari-web/test/utils/configs/config_initializer_test.js

@@ -203,6 +203,7 @@ describe('App.ConfigInitializer', function () {
         dependencies: {
           'hive.metastore.uris': 'thrift://localhost:9083'
         },
+        filename: 'hive-site.xml',
         recommendedValue: 'thrift://localhost:9083',
         value: 'thrift://h0:9083,thrift://h1:9083',
         title: 'comma separated list of Metastore hosts with thrift prefix and port'
@@ -348,7 +349,8 @@ describe('App.ConfigInitializer', function () {
     it(cases['hive.metastore.uris'].title, function () {
       serviceConfigProperty.setProperties({
         name: 'hive.metastore.uris',
-        recommendedValue: cases['hive.metastore.uris'].recommendedValue
+        recommendedValue: cases['hive.metastore.uris'].recommendedValue,
+        filename: 'hive-site.xml'
       });
       App.ConfigInitializer.initialValue(serviceConfigProperty, cases['hive.metastore.uris'].localDB, {'hive.metastore.uris': cases['hive.metastore.uris'].recommendedValue});
       expect(serviceConfigProperty.get('value')).to.equal(cases['hive.metastore.uris'].value);
@@ -727,6 +729,7 @@ describe('App.ConfigInitializer', function () {
       },
       {
         config: 'hive.metastore.uris',
+        filename: 'hive-site.xml',
         localDB: getLocalDBForMultipleComponents('HIVE_METASTORE', 2),
         dependencies: {
           'hive.metastore.uris': 'thrift://localhost:9083'