ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-8839. Kerberos Wizard: Configure Identities page is broken. (jaimin)
Date Fri, 19 Dec 2014 23:17:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f8a9bd90c -> 9ba813875


AMBARI-8839. Kerberos Wizard: Configure Identities page is broken. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9ba81387
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9ba81387
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9ba81387

Branch: refs/heads/trunk
Commit: 9ba8138754a7caed5c765c2060393fe9ba24c46a
Parents: f8a9bd9
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Fri Dec 19 15:16:33 2014 -0800
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Fri Dec 19 15:17:27 2014 -0800

----------------------------------------------------------------------
 .../HDP/2.2/services/ZOOKEEPER/kerberos.json    |   2 +-
 .../app/mixins/wizard/addSecurityConfigs.js     | 112 ++++++++++---------
 2 files changed, 59 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9ba81387/ambari-server/src/main/resources/stacks/HDP/2.2/services/ZOOKEEPER/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/ZOOKEEPER/kerberos.json
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/ZOOKEEPER/kerberos.json
index ddec01f..b22d5fe 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/ZOOKEEPER/kerberos.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/ZOOKEEPER/kerberos.json
@@ -14,7 +14,7 @@
             {
               "name": "zookeeper_zk",
               "principal": {
-                "value": "zk/_HOST@${realm}",
+                "value": "zookeeper/_HOST@${realm}",
                 "configuration": "zookeeper-env/zookeeper_principal_name"
               },
               "keytab": {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ba81387/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 5e741b6..c93570c 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -112,8 +112,8 @@ App.AddSecurityConfigs = Em.Mixin.create({
     return configs;
   }.property('App.isHadoop22Stack'),
 
-  secureServices: function() {
-    return  this.get('content.services');
+  secureServices: function () {
+    return this.get('content.services');
   }.property('content.services'),
 
   /**
@@ -248,9 +248,9 @@ App.AddSecurityConfigs = Em.Mixin.create({
    */
   loadUiSideSecureConfigs: function () {
     var uiConfig = [];
-    var configs = this.get('secureMapping').filterProperty('foreignKey', null).filter(function(_configProperty){
+    var configs = this.get('secureMapping').filterProperty('foreignKey', null).filter(function
(_configProperty) {
       return (App.Service.find().mapProperty('serviceName').contains(_configProperty.serviceName));
-    },this);
+    }, this);
     configs.forEach(function (_config) {
       var value = _config.value;
       if (_config.hasOwnProperty('dependedServiceName')) {
@@ -388,18 +388,18 @@ App.AddSecurityConfigs = Em.Mixin.create({
   /**
    * Generate stack descriptor configs.
    *
-   * @returns {$.Deferred} 
+   * @returns {$.Deferred}
    */
-  getStackDescriptorConfigs: function() {
+  getStackDescriptorConfigs: function () {
     return this.loadStackDescriptorConfigs().pipe(this.createServicesStackDescriptorConfigs.bind(this));
   },
 
   /**
-   * 
+   *
    * @param {object[]} items - stack descriptor json response
-   * @returns {App.ServiceConfigProperty[]} 
+   * @returns {App.ServiceConfigProperty[]}
    */
-  createServicesStackDescriptorConfigs: function(items) {
+  createServicesStackDescriptorConfigs: function (items) {
     var self = this;
     var configs = [];
     var clusterConfigs = [];
@@ -411,20 +411,22 @@ App.AddSecurityConfigs = Em.Mixin.create({
     clusterConfigs = clusterConfigs.concat(this.createConfigsByIdentities(kerberosDescriptor.identities,
'Cluster'));
     clusterConfigs.setEach('serviceName', 'Cluster');
     // generate properties for services object
-    kerberosDescriptor.services.forEach(function(service) {
+    kerberosDescriptor.services.forEach(function (service) {
       var serviceName = service.name;
-      service.components.forEach(function(component) {
+      service.components.forEach(function (component) {
         var componentName = component.name;
-        var identityConfigs = self.createConfigsByIdentities(component.identities, componentName);
-        identityConfigs.setEach('serviceName', serviceName);
-        configs = configs.concat(identityConfigs);
+        if (component.identities) {
+          var identityConfigs = self.createConfigsByIdentities(component.identities, componentName);
+          identityConfigs.setEach('serviceName', serviceName);
+          configs = configs.concat(identityConfigs);
+        }
       });
-    });    
+    });
     // unite cluster and service configs
     configs = configs.concat(clusterConfigs);
     self.processConfigReferences(kerberosDescriptor, configs);
     // return configs with uniq names
-    return configs.reduce(function(p,c) {
+    return configs.reduce(function (p, c) {
       if (!p.findProperty('name', c.get('name'))) p.push(c);
       return p;
     }, []);
@@ -435,13 +437,13 @@ App.AddSecurityConfigs = Em.Mixin.create({
    *
    * @param {object[]} identities
    * @param {string} componentName
-   * @returns {App.ServiceConfigProperty[]} 
+   * @returns {App.ServiceConfigProperty[]}
    */
-  createConfigsByIdentities: function(identities, componentName) {
+  createConfigsByIdentities: function (identities, componentName) {
     var self = this;
     var configs = [];
-    
-    identities.forEach(function(identity) {
+
+    identities.forEach(function (identity) {
       var defaultObject = {
         isOverridable: false,
         isVisible: true,
@@ -450,7 +452,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
         name: identity.name
       };
 
-      self.parseIdentityObject(identity).forEach(function(item) {
+      self.parseIdentityObject(identity).forEach(function (item) {
         configs.push(App.ServiceConfigProperty.create($.extend({}, defaultObject, item)));
       });
     });
@@ -463,13 +465,13 @@ App.AddSecurityConfigs = Em.Mixin.create({
    * App.ServiceConfigProperty model class instances.
    *
    * @param {object} identity
-   * @returns {object[]} 
+   * @returns {object[]}
    */
-  parseIdentityObject: function(identity) {
+  parseIdentityObject: function (identity) {
     var result = [];
     var name = identity.name;
     var keys = Em.keys(identity).without('name');
-    keys.forEach(function(item) {
+    keys.forEach(function (item) {
       var configObject = {};
       var prop = identity[item];
       var itemValue = prop[{keytab: 'file', principal: 'value'}[item]];
@@ -490,13 +492,13 @@ App.AddSecurityConfigs = Em.Mixin.create({
 
   /**
    * Wrap kerberos properties to App.ServiceConfigProperty model class instances.
-   * 
+   *
    * @param {object} kerberosProperties
-   * @returns {App.ServiceConfigProperty[]} 
+   * @returns {App.ServiceConfigProperty[]}
    */
-  expandKerberosStackDescriptorProps: function(kerberosProperties) {
+  expandKerberosStackDescriptorProps: function (kerberosProperties) {
     var configs = [];
-    
+
     for (var propertyName in kerberosProperties) {
       var propertyObject = {
         name: propertyName,
@@ -518,26 +520,26 @@ App.AddSecurityConfigs = Em.Mixin.create({
   /**
    * Take care about configs that should observe value from referenced configs.
    * Reference is set with `referenceProperty` key.
-   * 
+   *
    * @param {object[]} kerberosDescriptor
    * @param {App.ServiceConfigProperty[]} configs
    */
-  processConfigReferences: function(kerberosDescriptor, configs) {
+  processConfigReferences: function (kerberosDescriptor, configs) {
     var identities = kerberosDescriptor.identities;
-    identities = identities.concat(kerberosDescriptor.services.map(function(service) {
+    identities = identities.concat(kerberosDescriptor.services.map(function (service) {
       var _identities = service.identities || [];
       if (service.components && !!service.components.length) {
-        identities = identities.concat(service.components.mapProperty('identities').reduce(function(p,
c) {
+        identities = identities.concat(service.components.mapProperty('identities').reduce(function
(p, c) {
           return p.concat(c);
         }, []));
         return identities;
       }
-    }).reduce(function(p, c) {
+    }).reduce(function (p, c) {
       return p.concat(c);
     }, []));
     // clean up array
     identities = identities.compact().without(undefined);
-    configs.forEach(function(item) {
+    configs.forEach(function (item) {
       var reference = item.get('referenceProperty');
       if (!!reference) {
         var identity = identities.findProperty('name', reference.split(':')[0])[reference.split(':')[1]];
@@ -555,37 +557,39 @@ App.AddSecurityConfigs = Em.Mixin.create({
    * @param kerberosDescriptor {Object}
    * @param configs {Object}
    */
-  updateKerberosDescriptor: function(kerberosDescriptor, configs) {
-    configs.forEach(function(_config){
+  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;
+            kerberosDescriptor.properties[key] = _config.value;
           }
         }
       } else if (_config.name.endsWith('_principal') || _config.name.endsWith('_keytab'))
{
         var identities = kerberosDescriptor.identities;
-        identities.forEach(function(_identity){
+        identities.forEach(function (_identity) {
           if (_config.name.startsWith(_identity.name)) {
             if (_config.name.endsWith('_principal')) {
-              _identity.principal.value =  _config.value;
+              _identity.principal.value = _config.value;
             } else if (_config.name.endsWith('_keytab')) {
-              _identity.keytab.file =  _config.value;
+              _identity.keytab.file = _config.value;
             }
           }
-        },this);
-      }  else {
-        kerberosDescriptor.services.forEach(function(_service) {
-          _service.components.forEach(function(_component){
-            _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);
+      } 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);
-        },this);
+        }, this);
       }
     }, this);
   },
@@ -593,9 +597,9 @@ App.AddSecurityConfigs = Em.Mixin.create({
   /**
    * Make request for stack descriptor configs.
    *
-   * @returns {$.ajax} 
+   * @returns {$.ajax}
    */
-  loadStackDescriptorConfigs: function() {
+  loadStackDescriptorConfigs: function () {
     return App.ajax.send({
       sender: this,
       name: 'admin.kerberize.stack_descriptor',


Mime
View raw message