ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [3/3] ambari git commit: AMBARI-17399. Hive llap principals are shown on Configure Identity even when Hive is not deployed (alexantonenko)
Date Thu, 23 Jun 2016 12:42:44 GMT
AMBARI-17399. Hive llap principals are shown on Configure Identity even when Hive is not deployed
(alexantonenko)


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

Branch: refs/heads/trunk
Commit: b83b3e274850fefcba22f330c15617375b04a325
Parents: 49a10f1
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Jun 23 14:09:00 2016 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Jun 23 15:42:37 2016 +0300

----------------------------------------------------------------------
 .../app/controllers/main/admin/kerberos.js      |  3 --
 .../main/admin/kerberos/step4_controller.js     | 25 ++++++------
 .../app/mixins/wizard/addSecurityConfigs.js     | 40 ++++++--------------
 ambari-web/app/utils/ajax/ajax.js               |  2 +-
 .../admin/kerberos/step4_controller_test.js     | 11 +-----
 5 files changed, 29 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b83b3e27/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index e795bdf..d1d5012 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -65,9 +65,6 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
     'none': Em.I18n.t('admin.kerberos.wizard.step1.option.manual')
   },
 
-  // use cluster descriptor instead of stack
-  loadStackDescriptorConfigs: Em.alias('loadClusterDescriptorConfigs'),
-
   getAddSecurityWizardStatus: function () {
     return App.db.getSecurityWizardStatus();
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/b83b3e27/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 1e165ab..6167ef2 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -75,17 +75,20 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
     var successCallback = function(data) {
       dfd.resolve(data);
     };
-    if (this.get('isWithinAddService')) {
-      App.ajax.send({
-        sender: this,
-        name: 'admin.kerberize.cluster_descriptor_artifact'
-      }).always(function(data, status) {
-        self.storeClusterDescriptorStatus(status === 'success');
-        self.loadClusterDescriptorConfigs().then(successCallback);
-      });
-    } else {
-      this.loadStackDescriptorConfigs().then(successCallback);
-    }
+    var checkDescriptor = function() {
+      if (self.get('isWithinAddService')) {
+        return App.ajax.send({
+          sender: self,
+          name: 'admin.kerberize.cluster_descriptor_artifact'
+        });
+      }
+      return $.Deferred().resolve().promise();
+    };
+
+    checkDescriptor().always(function(data, status) {
+      self.storeClusterDescriptorStatus(status === 'success');
+      self.loadClusterDescriptorConfigs(self.get('isWithinAddService') ? self.get('selectedServiceNames')
: false).then(successCallback);
+    });
     return dfd.promise();
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b83b3e27/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 a876804..7e495ea 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -84,7 +84,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
       // generate configs for service level identity objects
       configs = configs.concat(self.createResourceConfigs(service, serviceName));
       // generate configs for service component level identity  object
-      service.components.forEach(function (component) {
+      Em.getWithDefault(service, 'components', []).forEach(function (component) {
         configs = configs.concat(self.createResourceConfigs(component, serviceName));
       });
     });
@@ -327,7 +327,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
         kerberosDescriptor.services.forEach(function (_service) {
           isConfigUpdated = this.updateResourceIdentityConfigs(_service, _config);
           if (!isConfigUpdated) {
-            _service.components.forEach(function (_component) {
+            Em.getWithDefault(_service, 'components', []).forEach(function (_component) {
               isConfigUpdated = this.updateResourceIdentityConfigs(_component, _config);
             }, this);
           }
@@ -417,38 +417,22 @@ App.AddSecurityConfigs = Em.Mixin.create({
   },
 
   /**
-   * Check if cluster descriptor should be loaded
-   * @returns {Boolean}
-   */
-  shouldLoadClusterDescriptor: function() {
-    return App.get('isKerberosEnabled') && !App.router.get('mainAdminKerberosController.defaultKerberosLoaded');
-  }.property('App.isKerberosEnabled', 'App.router.mainAdminKerberosController.defaultKerberosLoaded'),
-
-  /**
-   * Make request for stack descriptor configs.
-   * @returns {$.ajax}
-   * @method loadStackDescriptorConfigs
-   */
-  loadStackDescriptorConfigs: function () {
-    return App.ajax.send({
-      sender: this,
-      name: 'admin.kerberize.stack_descriptor',
-      data: {
-        stackName: App.get('currentStackName'),
-        stackVersionNumber: App.get('currentStackVersionNumber')
-      }
-    });
-  },
-
-  /**
    * Make request for cluster descriptor configs.
+   *
+   * @param {string[]|null} [services=null] services to be added
    * @returns {$.ajax}
    * @method loadClusterDescriptorConfigs
    */
-  loadClusterDescriptorConfigs: function () {
+  loadClusterDescriptorConfigs: function (services) {
+    var servicesParam = services ? 'additional_services=' + services.join(',') : null,
+        queryParams = ['evaluate_when=true'].concat(servicesParam).compact().join('&');
+
     return App.ajax.send({
       sender: this,
-      name: 'admin.kerberize.cluster_descriptor'
+      name: 'admin.kerberize.cluster_descriptor',
+      data: {
+        queryParams: '?' + queryParams
+      }
     });
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/b83b3e27/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 2b46431..73b48b4 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1577,7 +1577,7 @@ var urls = {
     'mock': '/data/wizard/kerberos/stack_descriptors.json'
   },
   'admin.kerberize.cluster_descriptor': {
-    'real': '/clusters/{clusterName}/kerberos_descriptors/COMPOSITE',
+    'real': '/clusters/{clusterName}/kerberos_descriptors/COMPOSITE{queryParams}',
     'mock': '/data/wizard/kerberos/stack_descriptors.json'
   },
   'admin.kerberos.cluster.artifact.create': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b83b3e27/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
index 8ef0fe8..8bd2d1e 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -574,18 +574,17 @@ describe('App.KerberosWizardStep4Controller', function() {
 
     beforeEach(function() {
       c.reopen({
-        isWithinAddService: true
+        isWithinAddService: true,
+        selectedServiceNames: []
       });
       sinon.stub(c, 'storeClusterDescriptorStatus');
       sinon.stub(c, 'loadClusterDescriptorConfigs').returns(mock);
-      sinon.stub(c, 'loadStackDescriptorConfigs').returns(mock);
       sinon.stub(mock, 'then');
     });
 
     afterEach(function() {
       c.loadClusterDescriptorConfigs.restore();
       c.storeClusterDescriptorStatus.restore();
-      c.loadStackDescriptorConfigs.restore();
       mock.then.restore();
     });
 
@@ -613,12 +612,6 @@ describe('App.KerberosWizardStep4Controller', function() {
       expect(mock.then.calledOnce).to.be.true;
     });
 
-    it("loadStackDescriptorConfigs should be called", function() {
-      c.set('isWithinAddService', false);
-      c.getDescriptor();
-      expect(c.loadStackDescriptorConfigs.calledOnce).to.be.true;
-    });
-
     it("then should be called, isWithinAddService is false", function() {
       c.set('isWithinAddService', false);
       c.getDescriptor();


Mime
View raw message