Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0AE910D00 for ; Mon, 9 Feb 2015 16:47:21 +0000 (UTC) Received: (qmail 58328 invoked by uid 500); 9 Feb 2015 16:47:21 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 58301 invoked by uid 500); 9 Feb 2015 16:47:21 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 58292 invoked by uid 99); 9 Feb 2015 16:47:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2015 16:47:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9A723DFD59; Mon, 9 Feb 2015 16:47:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akovalenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-9532. Integrate keytab regeneration API. (akovalenko) Date: Mon, 9 Feb 2015 16:47:21 +0000 (UTC) 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 Authored: Mon Feb 9 16:19:32 2015 +0200 Committer: Aleksandr Kovalenko 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 regenerateKeytabs + * 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. Before dismissing, you should complete the wizard. 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 @@

{{t admin.security.enabled}} {{t admin.kerberos.button.disable}} +

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; + }); + }); });