You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/10/21 18:07:02 UTC
git commit: AMBARI-7883 Add Service should not be setting HDFS
configs when HDFS is not present. (atkach)
Repository: ambari
Updated Branches:
refs/heads/branch-1.7.0 c1e024521 -> 2fb3a48e0
AMBARI-7883 Add Service should not be setting HDFS configs when HDFS is not present. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2fb3a48e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2fb3a48e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2fb3a48e
Branch: refs/heads/branch-1.7.0
Commit: 2fb3a48e04d7642375e13d73a5072cc1fc58c5db
Parents: c1e0245
Author: atkach <at...@hortonworks.com>
Authored: Tue Oct 21 19:06:41 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Tue Oct 21 19:06:41 2014 +0300
----------------------------------------------------------------------
.../app/controllers/wizard/step8_controller.js | 72 ++++++++++++++++----
.../test/controllers/wizard/step8_test.js | 63 +++++++++++++++++
2 files changed, 120 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb3a48e/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 470c876..db4a591 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1396,8 +1396,9 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
tag = 'version' + (new Date).getTime();
coreSiteObject.tag = tag;
var coreSiteConfigs = this.get('configs').filterProperty('filename', 'core-site.xml');
- if (this.isConfigsChanged(coreSiteObject.properties, coreSiteConfigs))
+ if (this.isConfigsChanged(coreSiteObject.properties, coreSiteConfigs)) {
this.get('serviceConfigTags').pushObject(coreSiteObject);
+ }
}
selectedServices.forEach(function (service) {
@@ -1579,6 +1580,60 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
},
/**
+ * proxyuser configs which depend on service
+ */
+ optionalCoreSiteConfigs: [
+ {
+ serviceName: 'OOZIE',
+ user: 'oozie_user'
+ },
+ {
+ serviceName: 'HIVE',
+ user: 'hive_user'
+ },
+ {
+ serviceName: 'HIVE',
+ user: 'hcat_user'
+ },
+ {
+ serviceName: 'FALCON',
+ user: 'falcon_user'
+ }
+ ],
+
+ /**
+ * push proxyuser properties to core-site if they required by dependencies
+ * @param coreSiteObj
+ * @param installedAndSelectedServices
+ * @return {Object}
+ */
+ resolveProxyuserDependecies: function (coreSiteObj, installedAndSelectedServices) {
+ var coreSiteProperties = {};
+ var optionalCoreSiteConfigs = this.get('optionalCoreSiteConfigs');
+ var proxyuserGroup = this.get('configs').findProperty('name', 'proxyuser_group');
+
+ coreSiteObj.forEach(function (_coreSiteObj) {
+ //proxyuser_group property should be added only if proxyuser properties are used
+ if (_coreSiteObj.name === proxyuserGroup.name) return;
+
+ // exclude some configs if service wasn't selected
+ var addProperty = optionalCoreSiteConfigs.every(function (config) {
+ var userValue = this.get('configs').someProperty('name', config.user) ? this.get('configs').findProperty('name', config.user).value : null
+ return (installedAndSelectedServices.someProperty('serviceName', config.serviceName) ||
+ (_coreSiteObj.name != 'hadoop.proxyuser.' + userValue + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + userValue + '.groups'))
+ }, this);
+ if (addProperty) {
+ coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
+ }
+ }, this);
+
+ if (!App.isEmptyObject(coreSiteProperties) && proxyuserGroup) {
+ coreSiteProperties[proxyuserGroup.name] = proxyuserGroup.value;
+ }
+ return coreSiteProperties;
+ },
+
+ /**
* Create Core Site object
* @returns {{type: string, tag: string, properties: {}}}
* @method createCoreSiteObj
@@ -1588,23 +1643,10 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
installedAndSelectedServices.pushObjects(this.get('installedServices'));
installedAndSelectedServices.pushObjects(this.get('selectedServices'));
var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml'),
- coreSiteProperties = {},
- // some configs needs to be skipped if services are not selected
- isOozieSelected = installedAndSelectedServices.someProperty('serviceName', 'OOZIE'),
- oozieUser = this.get('configs').someProperty('name', 'oozie_user') ? this.get('configs').findProperty('name', 'oozie_user').value : null,
- isHiveSelected = installedAndSelectedServices.someProperty('serviceName', 'HIVE'),
- hiveUser = this.get('configs').someProperty('name', 'hive_user') ? this.get('configs').findProperty('name', 'hive_user').value : null,
- hcatUser = this.get('configs').someProperty('name', 'hcat_user') ? this.get('configs').findProperty('name', 'hcat_user').value : null,
+ coreSiteProperties = this.resolveProxyuserDependecies(coreSiteObj, installedAndSelectedServices),
isGLUSTERFSSelected = installedAndSelectedServices.someProperty('serviceName', 'GLUSTERFS');
coreSiteObj.forEach(function (_coreSiteObj) {
- // exclude some configs if service wasn't selected
- if (
- (isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) &&
- (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) &&
- (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
- coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
- }
if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.default.name") {
coreSiteProperties[_coreSiteObj.name] =
this.get('configs').someProperty('name', 'fs_glusterfs_default_name') ?
http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb3a48e/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 087badc..51c7b60 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -1462,4 +1462,67 @@ describe('App.WizardStep8Controller', function () {
});
+ describe("#resolveProxyuserDependecies()", function() {
+ it("No core-site configs", function() {
+ expect(installerStep8Controller.resolveProxyuserDependecies([], [])).to.be.empty;
+ });
+ it("Only proxyuser group config", function() {
+ var configs = [{
+ name: 'proxyuser_group'
+ }];
+ installerStep8Controller.set('configs', [{
+ name: 'proxyuser_group',
+ value: 'val1'
+ }]);
+ expect(installerStep8Controller.resolveProxyuserDependecies(configs, [])).to.be.empty;
+ });
+ it("Property should be added", function() {
+ var configs = [
+ {
+ name: 'proxyuser_group'
+ },
+ {
+ name: 'hadoop.proxyuser.user.hosts',
+ value: 'val2'
+ }
+ ];
+ installerStep8Controller.set('configs', [{
+ name: 'proxyuser_group',
+ value: 'val1'
+ }]);
+ expect(installerStep8Controller.resolveProxyuserDependecies(configs, [])).to.be.eql({
+ 'hadoop.proxyuser.user.hosts': 'val2',
+ 'proxyuser_group': 'val1'
+ });
+ });
+ it("Property should be skipped", function() {
+ var configs = [
+ {
+ name: 'proxyuser_group'
+ },
+ {
+ name: 'hadoop.proxyuser.user.hosts',
+ value: 'val2'
+ }
+ ];
+ installerStep8Controller.set('configs', [
+ {
+ name: 'proxyuser_group',
+ value: 'val1'
+ },
+ {
+ name: 'user1',
+ value: 'user'
+ }
+ ]);
+ installerStep8Controller.set('optionalCoreSiteConfigs', [
+ {
+ serviceName: 'S1',
+ user: 'user1'
+ }
+ ]);
+ expect(installerStep8Controller.resolveProxyuserDependecies(configs, [])).to.be.empty;
+ });
+ });
+
});