Explorar o código

AMBARI-2535. Security wizard: Webhcat configuration with hive is broken. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1498756 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly %!s(int64=12) %!d(string=hai) anos
pai
achega
e20bc930bb

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

@@ -993,6 +993,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   loadUiSideConfigs: function (configMapping) {
     var uiConfig = [];
     var configs = configMapping.filterProperty('foreignKey', null);
+    this.addDynamicProperties(configs);
     configs.forEach(function (_config) {
       var valueWithOverrides = this.getGlobConfigValueWithOverrides(_config.templateName, _config.value, _config.name);
       if (valueWithOverrides !== null) {
@@ -1008,6 +1009,21 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     return uiConfig;
   },
 
+
+  addDynamicProperties: function(configs) {
+    var allConfigs = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName')).get('configs');
+    var templetonHiveProperty =  allConfigs.someProperty('name', 'templeton.hive.properties');
+    if (!templetonHiveProperty && this.get('content.serviceName') === 'WEBHCAT') {
+      configs.pushObject({
+        "name": "templeton.hive.properties",
+        "templateName": ["hivemetastore_host"],
+        "foreignKey": null,
+        "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true",
+        "filename": "webhcat-site.xml"
+      });
+    }
+  },
+
   /**
    * return global config value
    * @param templateName
@@ -1590,6 +1606,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         var webhcatMasterHost = serviceConfigs.findProperty('name', 'webhcatserver_host');
         webhcatMasterHost.defaultValue = this.get('content.hostComponents').filterProperty('componentName', 'WEBHCAT_SERVER').mapProperty('host.hostName');
         globalConfigs.push(webhcatMasterHost);
+        var hiveMetastoreHost = this.get('serviceConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hivemetastore_host');
+        hiveMetastoreHost.defaultValue = App.Service.find('HIVE').get('hostComponents').findProperty('componentName', 'HIVE_SERVER').get('host.hostName');
+        globalConfigs.push(hiveMetastoreHost);
         break;
     }
   },

+ 14 - 0
ambari-web/app/controllers/wizard/step8_controller.js

@@ -177,6 +177,7 @@ App.WizardStep8Controller = Em.Controller.extend({
   loadUiSideConfigs: function () {
     var uiConfig = [];
     var configs = this.get('configMapping').filterProperty('foreignKey', null);
+    this.addDynamicProperties(configs);
     configs.forEach(function (_config) {
       var valueWithOverrides = this.getGlobConfigValueWithOverrides(_config.templateName, _config.value, _config.name);
       uiConfig.pushObject({
@@ -200,6 +201,19 @@ App.WizardStep8Controller = Em.Controller.extend({
     return uiConfig;
   },
 
+  addDynamicProperties: function(configs) {
+    var templetonHiveProperty =  this.get('content.serviceConfigProperties').someProperty('name', 'templeton.hive.properties');
+    if (!templetonHiveProperty) {
+      configs.pushObject({
+        "name": "templeton.hive.properties",
+        "templateName": ["hivemetastore_host"],
+        "foreignKey": null,
+        "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true",
+        "filename": "webhcat-site.xml"
+      });
+    }
+  },
+
   getRegisteredHosts: function () {
     var allHosts = this.get('content.hosts');
     var hosts = [];

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

@@ -623,13 +623,6 @@ var configs = [
     "value": "<templateName[0]>",
     "filename": "hbase-site.xml"
   },
-  {
-    "name": "templeton.hive.properties",
-    "templateName": ["hivemetastore_host"],
-    "foreignKey": null,
-    "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true",
-    "filename": "webhcat-site.xml"
-  },
   {
     "name": "templeton.zookeeper.hosts",
     "templateName": ["zookeeperserver_hosts"],

+ 4 - 4
ambari-web/app/data/secure_mapping.js

@@ -362,11 +362,11 @@ module.exports = [
     "serviceName": "WEBHCAT"
   },
   {
-    "name": "templeton.kerberos.properties",
-    "templateName": ["hive_user"],
+    "name": "templeton.hive.properties",
+    "templateName": ["hivemetastore_host","hive_metastore_principal_name","kerberos_domain"],
     "foreignKey": null,
-    "value": "hive.metastore.local=false, hive.metastore.uris=thrift://MetastoreHost_FQDN:9083, hive.q" +
-      "metastore.sasl.enabled=true,hive.metastore.execute.setugi= true, hive.exec.mode.local.auto=false, hive.metastore.kerberos.principal=<templateName[0]>/_HOST@EXAMPLE.COM",
+    "value": "hive.metastore.local=false, hive.metastore.uris=thrift://<templateName[0]>:9083, hive." +
+      "metastore.sasl.enabled=true,hive.metastore.execute.setugi=true, hive.exec.mode.local.auto=false, hive.metastore.kerberos.principal=<templateName[1]>@<templateName[2]>",
     "filename": "webhcat-site.xml",
     "serviceName": "WEBHCAT"
   },