You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2015/01/17 01:43:38 UTC
ambari git commit: AMBARI-9187. Kerberoz wizard->Configure Identities
page: Values of the Principal with _name in the suffix are not getting
updated. (jaimin)
Repository: ambari
Updated Branches:
refs/heads/trunk 1ab69ecdb -> 521e2e391
AMBARI-9187. Kerberoz wizard->Configure Identities page: Values of the Principal with _name in the suffix are not getting updated. (jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/521e2e39
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/521e2e39
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/521e2e39
Branch: refs/heads/trunk
Commit: 521e2e391eb1c6a707a498d351ba9111e2bdc41b
Parents: 1ab69ec
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Fri Jan 16 16:42:46 2015 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Fri Jan 16 16:42:46 2015 -0800
----------------------------------------------------------------------
.../app/mixins/wizard/addSecurityConfigs.js | 109 ++++++++++++++-----
1 file changed, 80 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/521e2e39/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index 2c63120..29455f1 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -299,8 +299,8 @@ App.AddSecurityConfigs = Em.Mixin.create({
var configs = this.get('configs').findProperty('name', templateName[index]);
var configValue = templateName[index] == 'hive_metastore' ?
configs.value.map(function (hostName) {
- return 'thrift://' + hostName + ':9083';
- }).join(',') : configs.value;
+ return 'thrift://' + hostName + ':9083';
+ }).join(',') : configs.value;
if (!!value) {
value = (configs) ? App.config.replaceConfigValues(name, _express, value, configValue) : null;
@@ -562,39 +562,90 @@ App.AddSecurityConfigs = Em.Mixin.create({
*/
updateKerberosDescriptor: function (kerberosDescriptor, configs) {
configs.forEach(function (_config) {
- if (Object.keys(kerberosDescriptor.properties).contains(_config.name)) {
- for (var key in kerberosDescriptor.properties) {
- if (key === _config.name) {
- kerberosDescriptor.properties[key] = _config.value;
- }
- }
- } else if (_config.name.endsWith('_principal') || _config.name.endsWith('_keytab')) {
- var identities = kerberosDescriptor.identities;
- identities.forEach(function (_identity) {
- if (_config.name.startsWith(_identity.name)) {
- if (_config.name.endsWith('_principal')) {
- _identity.principal.value = _config.value;
- } else if (_config.name.endsWith('_keytab')) {
- _identity.keytab.file = _config.value;
- }
+ var isConfigUpdated;
+ var isStackResouce = true;
+ isConfigUpdated = this.updateResourceIdentityConfigs(kerberosDescriptor, _config, isStackResouce);
+ if (!isConfigUpdated) {
+ kerberosDescriptor.services.forEach(function (_service) {
+ isConfigUpdated = this.updateResourceIdentityConfigs(_service, _config);
+ if (!isConfigUpdated) {
+ _service.components.forEach(function (_component) {
+ isConfigUpdated = this.updateResourceIdentityConfigs(_component, _config);
+ }, this);
}
}, this);
- } else {
- kerberosDescriptor.services.forEach(function (_service) {
- _service.components.forEach(function (_component) {
- if (_component.identities) {
- _component.identities.forEach(function (_identity) {
- if (_identity.principal && _identity.principal.configuration && _identity.principal.configuration.endsWith(_config.name)) {
- _identity.principal.value = _config.value;
- } else if (_identity.keytab && _identity.keytab.configuration && _identity.keytab.configuration.endsWith(_config.name)) {
- _identity.keytab.file = _config.value;
- }
- }, this);
+ }
+ }, this);
+ },
+
+ /**
+ * Updates the identity configs or configurations at a resource. A resource could be
+ * 1) Stack
+ * 2) Service
+ * 3) Component
+ * @param resource
+ * @param config
+ * @param isStackResource
+ * @return boolean
+ */
+ updateResourceIdentityConfigs: function (resource, config, isStackResource) {
+ var isConfigUpdated;
+ var identities = resource.identities;
+ var properties = !!isStackResource ? resource.properties : resource.configurations;
+ isConfigUpdated = this.updateDescriptorConfigs(properties, config);
+ if (!isConfigUpdated) {
+ if (identities) {
+ isConfigUpdated = this.updateDescriptorIdentityConfig(identities, config);
+ }
+ }
+ return isConfigUpdated;
+ },
+
+ /**
+ *
+ * @param configurations
+ * @param config
+ * @return boolean
+ */
+ updateDescriptorConfigs: function (configurations, config) {
+ var isConfigUpdated;
+ if (!!configurations) {
+ if (Array.isArray(configurations)) {
+ configurations.forEach(function (_configuration) {
+ for (var key in _configuration) {
+ if (Object.keys(_configuration[key]).contains(config.name)) {
+ _configuration[key][config.name] = config.value;
+ isConfigUpdated = true
}
- }, this);
+ }
}, this);
+ } else if (Object.keys(configurations).contains(config.name)) {
+ configurations[config.name] = config.value;
+ isConfigUpdated = true
+ }
+ }
+ return isConfigUpdated;
+ },
+
+
+ /**
+ *
+ * @param identities
+ * @param config
+ * @return boolean
+ */
+ updateDescriptorIdentityConfig: function (identities, config) {
+ var isConfigUpdated = false;
+ identities.forEach(function (identity) {
+ if (identity.keytab && identity.keytab.configuration && identity.keytab.configuration.endsWith(config.name)) {
+ identity.keytab.file = config.value;
+ isConfigUpdated = true
+ } else if (identity.principal && identity.principal.configuration && identity.principal.configuration.endsWith(config.name)) {
+ identity.principal.value = config.value;
+ isConfigUpdated = true
}
}, this);
+ return isConfigUpdated;
},
/**