ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-16682 After deleting Kerberos (while enabled), Kerberos tab still shows it as enabled. (atkach)
Date Mon, 16 May 2016 15:40:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 862d548c9 -> acee4c8da


AMBARI-16682 After deleting Kerberos (while enabled), Kerberos tab still shows it as enabled.
(atkach)


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

Branch: refs/heads/branch-2.4
Commit: acee4c8daadb38171306fd2e4e6801b052c1ede6
Parents: 862d548
Author: Andrii Tkach <atkach@apache.org>
Authored: Mon May 16 18:19:43 2016 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Mon May 16 18:40:13 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 24 ++++++++++++++++
 ambari-web/app/messages.js                      |  4 +++
 .../test/controllers/main/service/item_test.js  | 30 ++++++++++++++++++++
 3 files changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/acee4c8d/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 9250bfc..b65a4e1 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1177,6 +1177,11 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
       popupHeader = Em.I18n.t('services.service.delete.popup.header'),
       dependentServicesToDeleteFmt = this.servicesDisplayNames(interDependentServices);
 
+    if (serviceName === 'KERBEROS') {
+      this.kerberosDeleteWarning(popupHeader);
+      return;
+    }
+
     if (App.Service.find().get('length') === 1) {
       //at least one service should be installed
       App.ModalPopup.show({
@@ -1212,6 +1217,25 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   },
 
   /**
+   * show dialog with Kerberos warning prior to service delete
+   * @param {string} header
+   * @returns {App.ModalPopup}
+   */
+  kerberosDeleteWarning: function(header) {
+    return App.ModalPopup.show({
+      primary: Em.I18n.t('ok'),
+      secondary: Em.I18n.t('services.alerts.goTo').format('Kerberos'),
+      header: header,
+      encodeBody: false,
+      body: Em.I18n.t('services.service.delete.popup.kerberos'),
+      onSecondary: function() {
+        this._super();
+        App.router.transitionTo('main.admin.adminKerberos.index');
+      }
+    });
+  },
+
+  /**
    * warning that show dependent services which must be deleted prior to chosen service deletion
    * @param {string} origin
    * @param {string[]} dependent

http://git-wip-us.apache.org/repos/asf/ambari/blob/acee4c8d/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index c3b8a5c..74f918d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -517,6 +517,7 @@ Em.I18n.translations = {
   'services.alerts.brLastCheck': '<br>Last Checked {0}',
   'services.alerts.occurredOn': 'Occurred on {0}, {1}',
   'services.alerts.goToService': 'Go to Service',
+  'services.alerts.goTo': 'Go to {0}',
 
   'services.summary.selectHostForComponent': 'Select the host to add {0} component',
   'services.summary.allHostsAlreadyRunComponent': 'All hosts already running {0} component',
@@ -1808,6 +1809,9 @@ Em.I18n.translations = {
   'services.service.actions.serviceActions':'Service Actions',
 
   'services.service.delete.popup.header': 'Delete Service',
+  'services.service.delete.popup.kerberos': 'The Kerberos Service <i>cannot be deleted</i>
because Kerberos is ' +
+  'currently enabled, and in use by the cluster. The Kerberos Service can only be removed
by disabling Kerberos,' +
+  ' which can be found by browsing to <b>Admin > Kerberos</b> and selecting
<b>Disable Kerberos</b>.',
   'services.service.delete.configVersionNote': 'Update configs after {0} has been removed',
   'services.service.delete.configVersionNote.plural': 'Update configs after {0} have been
removed',
   'services.service.delete.lastService.popup.body': 'The <b>{0}</b> service can\'t
be deleted, at least one service must be installed.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/acee4c8d/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 383aa2f..11908a4 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -1329,6 +1329,7 @@ describe('App.MainServiceItemController', function () {
       sinon.stub(App, 'showConfirmationPopup');
       sinon.stub(App.ModalPopup, 'show');
       sinon.stub(App.format, 'role', function(name) {return name});
+      sinon.stub(mainServiceItemController, 'kerberosDeleteWarning');
 
       mainServiceItemController.reopen({
         interDependentServices: []
@@ -1343,6 +1344,13 @@ describe('App.MainServiceItemController', function () {
       App.showConfirmationPopup.restore();
       App.ModalPopup.show.restore();
       App.format.role.restore();
+      mainServiceItemController.kerberosDeleteWarning.restore();
+    });
+
+    it("Kerberos delete should show specific warning", function() {
+      mainServiceItemController.deleteService('KERBEROS');
+      expect(mainServiceItemController.kerberosDeleteWarning.
+        calledWith(Em.I18n.t('services.service.delete.popup.header'))).to.be.true;
     });
 
     it("only one service installed", function() {
@@ -1393,6 +1401,28 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
+  describe("#kerberosDeleteWarning()", function () {
+    var mainServiceItemController;
+
+    beforeEach(function() {
+      mainServiceItemController = App.MainServiceItemController.create({});
+      sinon.spy(App.ModalPopup, 'show');
+      sinon.stub(App.router, 'transitionTo');
+    });
+
+    afterEach(function() {
+      App.ModalPopup.show.restore();
+      App.router.transitionTo.restore();
+    });
+
+    it("App.ModalPopup.show should be called", function() {
+      var popup = mainServiceItemController.kerberosDeleteWarning('header');
+      expect(App.ModalPopup.show.calledOnce).to.be.true;
+      popup.onSecondary();
+      expect(App.router.transitionTo.calledWith('main.admin.adminKerberos.index')).to.be.true;
+    });
+  });
+
   describe("#dependentServicesWarning()", function() {
     var mainServiceItemController;
 


Mime
View raw message