ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-9532. Integrate keytab regeneration API. (akovalenko)
Date Mon, 09 Feb 2015 16:47:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 26d068206 -> 21a97cc73


AMBARI-9532. Integrate keytab regeneration API. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 21a97cc73121201df0bae150dd6af86576885c12
Parents: 26d0682
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Mon Feb 9 16:19:32 2015 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Mon Feb 9 18:36:23 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/main/admin/kerberos.js      | 26 ++++++++++++++++++++
 ambari-web/app/messages.js                      |  1 +
 .../app/templates/main/admin/kerberos.hbs       |  1 +
 ambari-web/app/utils/ajax/ajax.js               | 15 +++++++++++
 .../controllers/main/admin/kerberos_test.js     | 19 ++++++++++++++
 5 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/21a97cc7/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 03e60ce..d8bee3d 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -59,6 +59,32 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
     });
   },
 
+  /**
+   * Show confirmation popup and after confirmation send request to regenerate keytabs
+   */
+  regenerateKeytabs: function () {
+    var self = this;
+    return App.showConfirmationPopup(function(){
+      App.ajax.send({
+        name: "admin.kerberos_security.regenerate_keytabs",
+        sender: self,
+        success: "regenerateKeytabsSuccess"
+      });
+    });
+  },
+
+  /**
+   * Success callback of <code>regenerateKeytabs</code>
+   * show background operations popup if appropriate option is set
+   */
+  regenerateKeytabsSuccess: function () {
+    App.router.get('applicationController').dataLoading().done(function (initValue) {
+      if (initValue) {
+        App.router.get('backgroundOperationsController').showPopup();
+      }
+    });
+  },
+
   getUpdatedSecurityStatus: function () {
     this.getSecurityStatus();
     return this.get('securityEnabled');

http://git-wip-us.apache.org/repos/asf/ambari/blob/21a97cc7/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 5702f24..f602525 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -937,6 +937,7 @@ Em.I18n.translations = {
   'admin.kerberos.wizard.header':'Enable Kerberos Wizard',
   'admin.kerberos.button.enable': 'Enable Kerberos',
   'admin.kerberos.button.disable': 'Disable Kerberos',
+  'admin.kerberos.button.regenerateKeytabs': 'Regenerate Keytabs',
   'admin.kerberos.wizard.exit.warning.msg': 'Configuring Kerberos is in progress. Do you
really want to exit the Enable Kerberos Wizard?',
   'admin.kerberos.wizard.exit.critical.msg': 'Configuring Kerberos is in progress. <strong>Before
dismissing, you should complete the wizard.</strong> Do you really want to exit the
Enable Kerberos Wizard?',
   'admin.kerberos.wizard.step1.header': 'Get Started',

http://git-wip-us.apache.org/repos/asf/ambari/blob/21a97cc7/ambari-web/app/templates/main/admin/kerberos.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/kerberos.hbs b/ambari-web/app/templates/main/admin/kerberos.hbs
index dd40a5c..23eab55 100644
--- a/ambari-web/app/templates/main/admin/kerberos.hbs
+++ b/ambari-web/app/templates/main/admin/kerberos.hbs
@@ -20,6 +20,7 @@
     <div>
       <p class="text-success">{{t admin.security.enabled}}
         <a class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isSubmitDisabled"}}
{{action notifySecurityOffPopup target="controller"}}>{{t admin.kerberos.button.disable}}
</a>
+        <button class="btn btn-success"{{action regenerateKeytabs target="controller"}}><i
class="icon-repeat"></i> {{t admin.kerberos.button.regenerateKeytabs}}</button>
         <br/>
       </p>
     </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/21a97cc7/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 0749c6c..fb01bb2 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1487,6 +1487,21 @@ var urls = {
     }
   },
 
+  'admin.kerberos_security.regenerate_keytabs': {
+    'real': '/clusters/{clusterName}?regenerate_keytabs=true',
+    'mock': '',
+    'type': 'PUT',
+    'format': function (data) {
+      return {
+        data: JSON.stringify({
+          "Clusters" : {
+            "security_type" : "KERBEROS"
+          }
+        })
+      }
+    }
+  },
+
   'wizard.advanced_repositories.valid_url': {
     'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems/{osType}/repositories/{repoId}',
     'mock': '',

http://git-wip-us.apache.org/repos/asf/ambari/blob/21a97cc7/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 2198b14..6cbfe67 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -94,4 +94,23 @@ describe('App.MainAdminKerberosController', function() {
       expect(App.showClusterCheckPopup.called).to.be.false;
     });
   });
+
+  describe('#regenerateKeytabs()', function () {
+
+    beforeEach(function () {
+      sinon.spy(App, "showConfirmationPopup");
+      sinon.stub(App.ajax, 'send', Em.K);
+    });
+    afterEach(function () {
+      App.showConfirmationPopup.restore();
+      App.ajax.send.restore();
+    });
+
+    it('confirm popup should be displayed', function () {
+      var popup = controller.regenerateKeytabs();
+      expect(App.showConfirmationPopup.calledOnce).to.be.true;
+      popup.onPrimary();
+      expect(App.ajax.send.calledOnce).to.be.true;
+    });
+  });
 });


Mime
View raw message