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/06/29 22:45:22 UTC

ambari git commit: AMBARI-12197. Attempting to add service atlas does not show identities in kerberized cluster. (jaimin)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 96fe3f02e -> 5d40fa670


AMBARI-12197. Attempting to add service atlas does not show identities in kerberized cluster. (jaimin)


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

Branch: refs/heads/branch-2.1
Commit: 5d40fa670e87592132cb26ddc5cbf68172777122
Parents: 96fe3f0
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Mon Jun 29 13:44:38 2015 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Mon Jun 29 13:44:38 2015 -0700

----------------------------------------------------------------------
 .../main/admin/kerberos/step4_controller.js     | 47 +++++++++++++++++---
 .../controllers/main/service/add_controller.js  |  1 +
 .../app/mixins/wizard/addSecurityConfigs.js     | 11 ++++-
 3 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5d40fa67/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
index 6746f0a..08f4e10 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -29,7 +29,7 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
     this.set('selectedService', null);
     this.set('stepConfigs', []);
   },
-  
+
   loadStep: function() {
     if (this.get('wizardController.skipConfigureIdentitiesStep')) {
       App.router.send('next');
@@ -37,10 +37,23 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
     }
     var self = this;
     this.clearStep();
-    this.getDescriptorConfigs().then(function(properties) {
-      self.setStepConfigs(properties);
-      self.set('isRecommendedLoaded', true);
-    });
+     if (this.get('wizardController.name') === 'addServiceController' && this.get('shouldLoadClusterDescriptor')) {
+     // merge saved properties with default ones for the newly added service
+       this.loadClusterDescriptorConfigs().always(function(clusterDescriptorConfigs,textStatus) {
+         var clusterProperties =  textStatus === 'success' ? self.createServicesStackDescriptorConfigs.call(self, clusterDescriptorConfigs) : [];
+         self.loadStackDescriptorConfigs().always(function(stackDescriptorConfigs, textStatus) {
+           var stackProperties =  textStatus === 'success' ? self.createServicesStackDescriptorConfigs.call(self, stackDescriptorConfigs) : [];
+            self.setStepConfigs(clusterProperties, stackProperties);
+            self.set('isRecommendedLoaded', true);
+         });
+       });
+     } else {
+       this.getDescriptorConfigs().then(function (properties) {
+         self.setStepConfigs(properties);
+       }).always(function() {
+         self.set('isRecommendedLoaded', true);
+       });
+     }
   },
 
   /**
@@ -105,15 +118,35 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
    * Prepare step configs using stack descriptor properties.
    * 
    * @param {App.ServiceConfigProperty[]} configs
+   * @param {App.ServiceConfigProperty[]} stackConfigs
    */
-  setStepConfigs: function(configs) {
-    var configProperties = this.prepareConfigProperties(configs);
+  setStepConfigs: function(configs, stackConfigs) {
+    var configProperties = this.prepareConfigProperties(configs),
+      stackConfigProperties = stackConfigs ? this.prepareConfigProperties(stackConfigs) : [],
+      alterProperties = ['value','initialValue', 'defaultValue'];
     if (this.get('wizardController.name') == 'addServiceController') {
       // config properties for installed services should be disabled on Add Service Wizard
       configProperties.forEach(function(item) {
         if (this.get('adminPropertyNames').mapProperty('name').contains(item.get('name'))) return;
         if (this.get('installedServiceNames').contains(item.get('serviceName')) || item.get('serviceName') == 'Cluster') {
           item.set('isEditable', false);
+        } else if (stackConfigs) {
+          var stackConfigProperty = stackConfigProperties.filterProperty('filename', item.get('filename')).findProperty('name', item.get('name'));
+          if (stackConfigProperty) {
+            alterProperties.forEach(function (alterProperty) {
+              item.set(alterProperty, stackConfigProperty.get(alterProperty));
+            });
+          }
+        }
+      }, this);
+      // Concat properties that are present in the stack's kerberos  descriptor but not in the cluster kerberos descriptor
+      stackConfigProperties.forEach(function(_stackConfigProperty){
+        var isPropertyInClusterDescriptor = configProperties.filterProperty('filename', _stackConfigProperty.get('filename')).someProperty('name', _stackConfigProperty.get('name'));
+        if (!isPropertyInClusterDescriptor) {
+          if (this.get('installedServiceNames').contains(_stackConfigProperty.get('serviceName')) || _stackConfigProperty.get('serviceName') == 'Cluster') {
+            _stackConfigProperty.set('isEditable', false);
+          }
+          configProperties.pushObject(_stackConfigProperty);
         }
       }, this);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d40fa67/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index a33ccaf..adf5c37 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -300,6 +300,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
     if (App.router.get('mainAdminKerberosController.securityEnabled')) {
       this.getDescriptorConfigs().then(function(properties) {
         self.set('kerberosDescriptorConfigs', properties);
+      }).always(function(){
         dfd.resolve();
       });
     } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5d40fa67/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 7e436ae..0b4a51e 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -664,12 +664,21 @@ App.AddSecurityConfigs = Em.Mixin.create({
    * @method loadStackDescriptorConfigs
    */
   loadDescriptorConfigs: function() {
-    if (App.router.get('mainAdminKerberosController.securityEnabled') && !App.router.get('mainAdminKerberosController.defaultKerberosLoaded')) {
+    if (this.get('shouldLoadClusterDescriptor')) {
       return this.loadClusterDescriptorConfigs();
     } else {
       return this.loadStackDescriptorConfigs();
     }
   },
+
+  /**
+   * Check if cluster descriptor should be loaded
+   * @returns {Boolean}
+   */
+  shouldLoadClusterDescriptor: function() {
+    return App.router.get('mainAdminKerberosController.securityEnabled') && !App.router.get('mainAdminKerberosController.defaultKerberosLoaded');
+  }.property('App.router.mainAdminKerberosController.securityEnabled', 'App.router.mainAdminKerberosController.defaultKerberosLoaded'),
+
   /**
    * Make request for stack descriptor configs.
    * @returns {$.ajax}