You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2016/02/08 14:10:14 UTC
[2/3] ambari git commit: AMBARI-14954 Adding HiveServer2 should not
change "hadoop.proxyuser.webhcat.hosts" property. (ababiichuk)
AMBARI-14954 Adding HiveServer2 should not change "hadoop.proxyuser.webhcat.hosts" property. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7051ef64
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7051ef64
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7051ef64
Branch: refs/heads/trunk
Commit: 7051ef64e76b93ddfe7b7eb996b8e33961af406f
Parents: 91897d9
Author: ababiichuk <ab...@hortonworks.com>
Authored: Mon Feb 8 14:38:26 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Mon Feb 8 14:43:13 2016 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 44 +++++++--
.../configs/add_component_config_initializer.js | 13 ++-
.../test/controllers/main/host/details_test.js | 97 ++++++++++++++------
3 files changed, 115 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7051ef64/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index a161342..bbd1bf7 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -419,7 +419,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
this.loadConfigs('loadHiveConfigs');
} else if (data.componentName == 'WEBHCAT_SERVER') {
this.set('deleteWebHCatServer', true);
- this.loadConfigs('loadHiveConfigs');
+ this.loadConfigs('loadWebHCatConfigs');
} else if (data.componentName == 'HIVE_SERVER') {
this.set('deleteHiveServer', true);
this.loadConfigs('loadHiveConfigs');
@@ -578,7 +578,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
case 'WEBHCAT_SERVER':
returnFunc = App.showConfirmationPopup(function () {
self.set('webhcatServerHost', hostName);
- self.loadConfigs("loadHiveConfigs");
+ self.loadConfigs("loadWebHCatConfigs");
}, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
break;
case 'NIMBUS':
@@ -851,6 +851,28 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
* @param {object} data
* @method loadHiveConfigs
*/
+ loadWebHCatConfigs: function (data) {
+ return App.ajax.send({
+ name: 'admin.get.all_configurations',
+ sender: this,
+ data: {
+ webHCat: true,
+ urlParams: [
+ '(type=hive-site&tag=' + data.Clusters.desired_configs['hive-site'].tag + ')',
+ '(type=webhcat-site&tag=' + data.Clusters.desired_configs['webhcat-site'].tag + ')',
+ '(type=hive-env&tag=' + data.Clusters.desired_configs['hive-env'].tag + ')',
+ '(type=core-site&tag=' + data.Clusters.desired_configs['core-site'].tag + ')'
+ ].join('|')
+ },
+ success: 'onLoadHiveConfigs'
+ });
+ },
+
+ /**
+ * Success callback for load configs request
+ * @param {object} data
+ * @method loadHiveConfigs
+ */
loadHiveConfigs: function (data) {
return App.ajax.send({
name: 'admin.get.all_configurations',
@@ -870,21 +892,24 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
/**
* update and save Hive related configs to server
* @param {object} data
+ * @param {object} opt
+ * @param {object} params
* @method onLoadHiveConfigs
*/
- onLoadHiveConfigs: function (data) {
+ onLoadHiveConfigs: function (data, opt, params) {
var hiveMetastoreHost = this.get('hiveMetastoreHost');
var webhcatServerHost = this.get('webhcatServerHost');
var port = "";
var configs = {};
var attributes = {};
+ var userSetup = {};
var localDB = {
masterComponentHosts: this.getHiveHosts()
};
var dependencies = {
hiveMetastorePort: ""
};
- var initializer = App.AddHiveComponentsInitializer;
+ var initializer = params.webHCat ? App.AddWebHCatComponentsInitializer : App.AddHiveComponentsInitializer;
data.items.forEach(function (item) {
configs[item.type] = item.properties;
attributes[item.type] = item.properties_attributes || {};
@@ -896,10 +921,13 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
dependencies.hiveMetastorePort = port;
- initializer.setup({
- hiveUser: configs['hive-env']['hive_user'],
- webhcatUser: configs['hive-env']['webhcat_user']
- });
+ if (params.webHCat) {
+ userSetup.webhcatUser = configs['hive-env']['webhcat_user'];
+ } else {
+ userSetup.hiveUser = configs['hive-env']['hive_user'];
+ }
+
+ initializer.setup(userSetup);
['hive-site', 'webhcat-site', 'hive-env', 'core-site'].forEach(function(fileName) {
if (configs[fileName]) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7051ef64/ambari-web/app/utils/configs/add_component_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/add_component_config_initializer.js b/ambari-web/app/utils/configs/add_component_config_initializer.js
index 5bbe02c..466f7b1 100644
--- a/ambari-web/app/utils/configs/add_component_config_initializer.js
+++ b/ambari-web/app/utils/configs/add_component_config_initializer.js
@@ -298,7 +298,18 @@ App.AddHiveComponentsInitializer = App.AddComponentConfigInitializer.create({
initializeForProperties: [
'hive.metastore.uris',
'templeton.hive.properties',
- 'hadoop.proxyuser.{{webhcatUser}}.hosts',
'hadoop.proxyuser.{{hiveUser}}.hosts'
]
});
+
+/**
+ * WebHCat service add/remove components initializer.
+ * @instance App.AddComponentConfigInitializer
+ */
+App.AddWebHCatComponentsInitializer = App.AddComponentConfigInitializer.create({
+ initializeForProperties: [
+ 'hive.metastore.uris',
+ 'templeton.hive.properties',
+ 'hadoop.proxyuser.{{webhcatUser}}.hosts'
+ ]
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7051ef64/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 9bdd64c..c2ad8f2 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -3872,15 +3872,13 @@ describe('App.MainHostDetailsController', function () {
['hive.metastore.uris', 'thrift://host1:9090']
]),
makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
- ['webhcat_user', 'webhcat_user_val']
+ ['hive_user', 'hive_user_val']
]),
makeFileNameProps('webhcat-site', [
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083,hive.metastore.sasl.enabled=false']
]),
makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1'],
- ['hadoop.proxyuser.webhcat_user_val.hosts', 'host1']
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1']
])
]
},
@@ -3896,8 +3894,7 @@ describe('App.MainHostDetailsController', function () {
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9090,hive.metastore.sasl.enabled=false']
]).properties,
"hive-env": makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
- ['webhcat_user', 'webhcat_user_val']
+ ['hive_user', 'hive_user_val']
]).properties
},
"properties_attributes": makeEmptyPropAttrs("hive-site", "webhcat-site", "hive-env")
@@ -3905,8 +3902,7 @@ describe('App.MainHostDetailsController', function () {
{
"properties": {
"core-site": makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host2'],
- ['hadoop.proxyuser.webhcat_user_val.hosts', 'host1,host2']
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host2']
]).properties
},
"properties_attributes": makeEmptyPropAttrs("core-site")
@@ -3925,15 +3921,13 @@ describe('App.MainHostDetailsController', function () {
['hive.metastore.uris', 'thrift://host1']
]),
makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
- ['webhcat_user', 'webhcat_user_val']
+ ['hive_user', 'hive_user_val']
]),
makeFileNameProps('webhcat-site', [
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083,hive.metastore.sasl.enabled=false']
]),
makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1'],
- ['hadoop.proxyuser.webhcat_user_val.hosts', 'host1']
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1']
])
]
},
@@ -3949,8 +3943,7 @@ describe('App.MainHostDetailsController', function () {
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083\\,thrift://host2:9083\\,thrift://host3:9083,hive.metastore.sasl.enabled=false']
]).properties,
"hive-env": makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
- ['webhcat_user', 'webhcat_user_val']
+ ['hive_user', 'hive_user_val']
]).properties
},
"properties_attributes": makeEmptyPropAttrs("hive-site", "webhcat-site", "hive-env")
@@ -3958,8 +3951,7 @@ describe('App.MainHostDetailsController', function () {
{
"properties": {
"core-site": makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host2,host3'],
- ['hadoop.proxyuser.webhcat_user_val.hosts', 'host1,host2,host3']
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host2,host3']
]).properties
},
"properties_attributes": makeEmptyPropAttrs("core-site")
@@ -3979,15 +3971,13 @@ describe('App.MainHostDetailsController', function () {
['hive.metastore.uris', 'thrift://host1:1111']
]),
makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
- ['webhcat_user', 'webhcat_user_val']
+ ['hive_user', 'hive_user_val']
]),
makeFileNameProps('webhcat-site', [
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083,hive.metastore.sasl.enabled=false']
]),
makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1'],
- ['hadoop.proxyuser.webhcat_user_val.hosts', 'host1']
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1']
])
]
},
@@ -4003,8 +3993,7 @@ describe('App.MainHostDetailsController', function () {
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:1111\\,thrift://host2:1111\\,thrift://host3:1111,hive.metastore.sasl.enabled=false']
]).properties,
"hive-env": makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
- ['webhcat_user', 'webhcat_user_val']
+ ['hive_user', 'hive_user_val']
]).properties
},
"properties_attributes": makeEmptyPropAttrs("hive-site", "webhcat-site", "hive-env")
@@ -4012,8 +4001,7 @@ describe('App.MainHostDetailsController', function () {
{
"properties": {
"core-site": makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host2,host3'],
- ['hadoop.proxyuser.webhcat_user_val.hosts', 'host1,host2,host3']
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host2,host3']
]).properties
},
"properties_attributes": makeEmptyPropAttrs("core-site")
@@ -4029,25 +4017,24 @@ describe('App.MainHostDetailsController', function () {
webhcatServerHost: '',
hiveMetastoreHost: ''
},
+ webHCat: true,
configs: {
items: [
makeFileNameProps('hive-site', [
['hive.metastore.uris', 'thrift://host1:1111']
]),
makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
['webhcat_user', 'webhcat_user_val']
]),
makeFileNameProps('webhcat-site', [
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083,hive.metastore.sasl.enabled=false']
]),
makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1'],
['hadoop.proxyuser.webhcat_user_val.hosts', 'host1']
])
]
},
- m: 'Components: {0}, appropriate configs should be changed, thrift port should be default 9083, Controller Stubs: {1}',
+ m: 'Change WebHCat proxyuser',
e: {
configs: [
{
@@ -4059,7 +4046,6 @@ describe('App.MainHostDetailsController', function () {
['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:1111\\,thrift://host3:1111,hive.metastore.sasl.enabled=false']
]).properties,
"hive-env": makeFileNameProps('hive-env', [
- ['hive_user', 'hive_user_val'],
['webhcat_user', 'webhcat_user_val']
]).properties
},
@@ -4068,7 +4054,6 @@ describe('App.MainHostDetailsController', function () {
{
"properties": {
"core-site": makeFileNameProps('core-site', [
- ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host3'],
['hadoop.proxyuser.webhcat_user_val.hosts', 'host1,host3']
]).properties
},
@@ -4076,6 +4061,58 @@ describe('App.MainHostDetailsController', function () {
},
]
}
+ },
+ {
+ hostComponentModel: makeHostComponentModel(['HIVE_SERVER', 'HIVE_METASTORE', 'WEBHCAT_SERVER'], [['host1', 'host2'], ['host1','host2'], ['host1', 'host3']]),
+ ctrlStubs: {
+ fromDeleteHost: true,
+ 'content.hostName': 'host2',
+ webhcatServerHost: '',
+ hiveMetastoreHost: ''
+ },
+ configs: {
+ items: [
+ makeFileNameProps('hive-site', [
+ ['hive.metastore.uris', 'thrift://host1:1111']
+ ]),
+ makeFileNameProps('hive-env', [
+ ['hive_user', 'hive_user_val']
+ ]),
+ makeFileNameProps('webhcat-site', [
+ ['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:9083,hive.metastore.sasl.enabled=false']
+ ]),
+ makeFileNameProps('core-site', [
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1']
+ ])
+ ]
+ },
+ m: 'Components: {0}, appropriate configs should be changed, thrift port should be default 9083, Controller Stubs: {1}',
+ e: {
+ configs: [
+ {
+ "properties": {
+ "hive-site": makeFileNameProps('hive-site', [
+ ['hive.metastore.uris', 'thrift://host1:1111,thrift://host3:1111']
+ ]).properties,
+ "webhcat-site": makeFileNameProps('webhcat-site', [
+ ['templeton.hive.properties', 'hive.metastore.local=false,hive.metastore.uris=thrift://host1:1111\\,thrift://host3:1111,hive.metastore.sasl.enabled=false']
+ ]).properties,
+ "hive-env": makeFileNameProps('hive-env', [
+ ['hive_user', 'hive_user_val']
+ ]).properties
+ },
+ "properties_attributes": makeEmptyPropAttrs("hive-site", "webhcat-site", "hive-env")
+ },
+ {
+ "properties": {
+ "core-site": makeFileNameProps('core-site', [
+ ['hadoop.proxyuser.hive_user_val.hosts', 'host1,host3']
+ ]).properties
+ },
+ "properties_attributes": makeEmptyPropAttrs("core-site")
+ }
+ ]
+ }
}
];
@@ -4108,7 +4145,7 @@ describe('App.MainHostDetailsController', function () {
});
it('saveConfigsBatch is called with correct configs', function () {
- controller.onLoadHiveConfigs(test.configs);
+ controller.onLoadHiveConfigs(test.configs, null, {webHCat: test.webHCat});
var configs = controller.saveConfigsBatch.args[0];
var properties = configs[0];
expect(properties).to.be.eql(test.e.configs);