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-13012. Kerberos wizard: Inform user about the deletion of YARN log and local dir, and RM state format (alexantonenko)
Date Fri, 04 Sep 2015 14:29:55 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 515e49873 -> 6577e8b82


AMBARI-13012. Kerberos wizard: Inform user about the deletion of YARN log and local dir, and
RM state format (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 6577e8b825f6729178f8080522df1eab72412af8
Parents: 515e498
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Fri Sep 4 17:29:47 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Sep 4 17:29:47 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/main/admin/kerberos.js      | 85 ++++++++++++++++----
 ambari-web/app/messages.js                      |  1 +
 2 files changed, 70 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6577e8b8/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 7730d71..2d94566 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -54,18 +54,20 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
 
   notifySecurityOffPopup: function () {
     var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('popup.confirmation.commonHeader'),
-      primary: Em.I18n.t('ok'),
-      onPrimary: function () {
-        App.db.setSecurityDeployCommands(undefined);
-        self.setDisableSecurityStatus("RUNNING");
-        App.router.transitionTo('disableSecurity');
-        this.hide();
-      },
-      bodyClass: Ember.View.extend({
-        templateName: require('templates/main/admin/kerberos/notify_security_off_popup')
-      })
+    this.checkServiceWarnings().then(function() {
+      App.ModalPopup.show({
+        header: Em.I18n.t('popup.confirmation.commonHeader'),
+        primary: Em.I18n.t('ok'),
+        onPrimary: function () {
+          App.db.setSecurityDeployCommands(undefined);
+          self.setDisableSecurityStatus("RUNNING");
+          App.router.transitionTo('disableSecurity');
+          this.hide();
+        },
+        bodyClass: Ember.View.extend({
+          templateName: require('templates/main/admin/kerberos/notify_security_off_popup')
+        })
+      });
     });
   },
 
@@ -229,9 +231,12 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
   },
 
   startKerberosWizard: function () {
-    this.setAddSecurityWizardStatus('RUNNING');
-    App.router.get('kerberosWizardController').setDBProperty('onClosePath', 'main.admin.adminKerberos.index');
-    App.router.transitionTo('adminKerberos.adminAddKerberos');
+    var self = this;
+    this.checkServiceWarnings().then(function() {
+      self.setAddSecurityWizardStatus('RUNNING');
+      App.router.get('kerberosWizardController').setDBProperty('onClosePath', 'main.admin.adminKerberos.index');
+      App.router.transitionTo('adminKerberos.adminAddKerberos');
+    });
   },
 
   /**
@@ -528,6 +533,54 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
     } else {
       this.restartServicesAfterRegenerate(false, callback);
     }
-  }
+  },
+
+  /**
+   * List of the warnings regarding specific services before enabling/disabling Kerberos.
+   *
+   * @type {String[]}
+   */
+  serviceAlerts: function() {
+    var messages = [];
+    var serviceAlertMap = {
+      YARN: Em.I18n.t('admin.kerberos.service.alert.yarn')
+    };
+    var installedServices = App.Service.find().mapProperty('serviceName');
+    Em.keys(serviceAlertMap).forEach(function(serviceName) {
+      if (installedServices.contains(serviceName)) {
+        messages.push(serviceAlertMap[serviceName]);
+      }
+    });
+    return messages;
+  }.property(),
+
+  /**
+   * Check for additional info to display before enabling/disabling kerberos and show appropriate
+   * messages in popup if needed.
+   * @returns {$.Deferred} - promise
+   */
+  checkServiceWarnings: function() {
+    var dfd = $.Deferred();
+    this.displayServiceWarnings(this.get('serviceAlerts'), dfd);
+    return dfd.promise();
+  },
 
+  /**
+   * Show appropriate message regarding changes affected after enabling/disabling Kerberos
+   *
+   * @param {String[]} messages - list of the messages to display
+   * @param {$.Deferred} dfd - used to break recursive calls and reject/resolve promise returned
by <code>checkServiceWarnings</code>
+   */
+  displayServiceWarnings: function(messages, dfd) {
+    var self = this;
+    if (!messages.get('length')) {
+      dfd.resolve();
+    } else {
+      App.showConfirmationPopup(function() {
+        self.displayServiceWarnings(messages.slice(1), dfd);
+      }, messages[0], function() {
+        dfd.reject();
+      }, Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'));
+    }
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6577e8b8/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 7912937..ebc13a3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1080,6 +1080,7 @@ Em.I18n.translations = {
   'admin.kerberos.regenerate_keytabs.checkbox.label': ' Only regenerate keytabs for missing
hosts and components',
   'admin.kerberos.regenerate_keytabs.popup.restart.body': 'After keytab regerate is complete,
services relying on them <strong>must</strong> be restarted. This can be done
automatically, or manually.',
   'admin.kerberos.regenerate_keytabs.checkbox.restart.label': 'Automatically restart components
after keytab regeneration',
+  'admin.kerberos.service.alert.yarn': 'YARN log and local dir will be deleted and ResourceManager
state will be formatted as part of Enabling/Disabling Kerberos.',
 
   'admin.kerberos.disable.step1.task0.title': 'Stop Services',
   'admin.kerberos.disable.step1.task1.title': 'Unkerberize Cluster',


Mime
View raw message