ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-9819. Enable Kerberos Wizard hangs after Ambari upgrade 1.7.0->2.0.0 (alexantonenko)
Date Thu, 26 Feb 2015 17:00:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 278b7a027 -> 1cb8512e3


AMBARI-9819. Enable Kerberos Wizard hangs after Ambari upgrade 1.7.0->2.0.0 (alexantonenko)


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

Branch: refs/heads/branch-2.0.0
Commit: 1cb8512e318e1e131512a371db4a09f3e73d52cc
Parents: 278b7a0
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Feb 26 18:56:22 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Feb 26 18:59:09 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/main/admin/kerberos.js      | 33 ++++++++++----------
 ambari-web/app/routes/add_kerberos_routes.js    |  2 +-
 .../controllers/main/admin/kerberos_test.js     | 33 --------------------
 3 files changed, 18 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1cb8512e/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 0a2bf8d..70e2051 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -182,19 +182,33 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
    * @returns {$.Deferred}
    */
   getSecurityStatus: function () {
-    var dfd;
+    var self = this;
+    var dfd = $.Deferred();
     if (App.get('testMode')) {
-      dfd = $.Deferred();
       this.set('securityEnabled', !App.get('testEnableSecurity'));
       this.set('dataIsLoaded', true);
       dfd.resolve();
     } else {
       //get Security Status From Server
-      dfd = App.ajax.send({
+      App.ajax.send({
         name: 'admin.security_status',
         sender: this,
         success: 'getSecurityStatusSuccessCallback',
         error: 'errorCallback'
+      }).always(function() {
+        // check for kerberos descriptor artifact
+        if (self.get('securityEnabled')) {
+          self.loadClusterDescriptorConfigs().then(function() {
+            dfd.resolve();
+          }, function() {
+            // if kerberos descriptor doesn't exist in cluster artifacts we have to kerberize
cluster. 
+            // Show `Enable kerberos` button and set unsecure status.
+            self.set('securityEnabled', false);
+            dfd.resolve();
+          });
+        } else {
+          dfd.resolve();
+        }
       });
     }
     return dfd.promise();
@@ -226,19 +240,6 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
   },
 
   /**
-   * Override <code>App.AddSecurityConfigs</code>.
-   * @returns {$.Deferred}
-   */
-  getDescriptorConfigs: function() {
-    var self = this;
-    // handle not existing artifact resource cluster
-    return this._super().fail(function() {
-      // if artifacts/kerberos_descriptor absent we should kerberize cluster.
-      self.set('securityEnabled', false);
-    });
-  },
-
-  /**
    * Override <code>App.KerberosWizardStep4Controller</code>
    *
    * @param {App.ServiceConfigProperty[]} properties

http://git-wip-us.apache.org/repos/asf/ambari/blob/1cb8512e/ambari-web/app/routes/add_kerberos_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_kerberos_routes.js b/ambari-web/app/routes/add_kerberos_routes.js
index 7761c97..2cd87ea 100644
--- a/ambari-web/app/routes/add_kerberos_routes.js
+++ b/ambari-web/app/routes/add_kerberos_routes.js
@@ -254,7 +254,7 @@ module.exports = App.WizardRoute.extend({
         if (result === 'error' && data.status === 409) {
           step6Controller.putKerberosDescriptor(kerberosDescriptor);
         } else {
-          router.transitionTo('step6');
+          step6Controller.unkerberizeCluster();
         }
       });
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1cb8512e/ambari-web/test/controllers/main/admin/kerberos_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos_test.js b/ambari-web/test/controllers/main/admin/kerberos_test.js
index cee070b..7055cbd 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -144,37 +144,4 @@ describe('App.MainAdminKerberosController', function() {
 
   });
 
-  describe('#loadStep', function() {
-
-    it('security enabled but kerberos descriptor resource doesn\'t exist for cluster, security
can be enabled', function() {
-      var controller = App.MainAdminKerberosController.create({ securityEnabled: true });
-      sinon.stub(App.router, 'get').withArgs('mainAdminKerberosController.securityEnabled').returns(true);
-      sinon.spy(controller, 'setStepConfigs');
-      sinon.stub(controller, 'loadClusterDescriptorConfigs').returns($.Deferred().reject());
-      controller.loadStep();
-      App.router.get.restore();
-      controller.loadClusterDescriptorConfigs.restore();
-      // configurations will not set
-      expect(controller.setStepConfigs.called).to.be.false;
-      controller.setStepConfigs.restore();
-      // security status should change to `false`
-      expect(controller.get('securityEnabled')).to.be.false;
-    });
-
-    it('security enabled and kerberos descriptor artifacts resource saved, security was enabled
successfully', function() {
-      var controller = App.MainAdminKerberosController.create({ securityEnabled: true });
-      sinon.stub(App.router, 'get').withArgs('mainAdminKerberosController.securityEnabled').returns(true);
-      sinon.stub(controller, 'setStepConfigs').returns(true);
-      sinon.stub(controller, 'createServicesStackDescriptorConfigs').returns($.Deferred().resolve());
-      sinon.stub(controller, 'loadClusterDescriptorConfigs').returns($.Deferred().resolve());
-      controller.loadStep();
-      App.router.get.restore();
-      controller.createServicesStackDescriptorConfigs.restore();
-      controller.loadClusterDescriptorConfigs.restore();
-      // configurations will set with current descriptor object
-      expect(controller.setStepConfigs.called).to.be.true;
-      controller.setStepConfigs.restore();
-    });
-
-  });
 });


Mime
View raw message