Forráskód Böngészése

AMBARI-10068. Add Host incorrectly changes webhcat properties. (jaimin)

Jaimin Jetly 10 éve
szülő
commit
c61c920bca

+ 1 - 1
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/kerberos.json

@@ -21,7 +21,7 @@
         {
           "webhcat-site": {
             "templeton.kerberos.secret": "secret",
-            "templeton.hive.properties": "hive.metastore.local=false,hive.metastore.uris=thrift://${host}:9083,hive.metastore.sasl.enabled=true,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse,hive.exec.mode.local.auto=false,hive.metastore.kerberos.principal=hive/_HOST@${realm}"
+            "templeton.hive.properties": "hive.metastore.local=false,hive.metastore.uris=thrift://${clusterHostInfo/hive_metastore_host}:9083,hive.metastore.sasl.enabled=true,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse,hive.exec.mode.local.auto=false,hive.metastore.kerberos.principal=hive/_HOST@${realm}"
           }
         },
         {

+ 23 - 1
ambari-web/app/controllers/main/admin/kerberos/step4_controller.js

@@ -189,11 +189,33 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
           property.set('displayType', siteProperty.displayType);
         }
       }
-    });
+      this.tweakConfigProperty(property);
+    },this);
 
     return configProperties;
   },
 
+  /**
+   * Function to override kerberos descriptor's property values
+   */
+  tweakConfigProperty: function(config) {
+    if (config.name === 'templeton.hive.properties') {
+      var defaultHiveMsPort = "9083";
+      var hiveMSHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_METASTORE');
+      if (hiveMSHosts.length > 1) {
+        var hiveMSHostNames = hiveMSHosts.mapProperty('hostName');
+        var port = config.value.match(/:[0-9]{2,4}/);
+        port = port ? port[0].slice(1) : defaultHiveMsPort;
+        for (var i = 0; i < hiveMSHostNames.length; i++) {
+          hiveMSHostNames[i] = "thrift://" + hiveMSHostNames[i] + ":" + port;
+        }
+        var configValue =  config.value.replace(/thrift.+[0-9]{2,},/i, hiveMSHostNames.join('\\,') + ",");
+        config.set('value', configValue);
+        config.set('defaultValue', configValue);
+      }
+    }
+  },
+
   /**
    * Sync up values between inherited property and its reference.
    *