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-12507. Add Service Wizard: when you add Oozie, HDFS and YARN are automatically shutdown and restarted (alexantonenko)
Date Wed, 22 Jul 2015 19:42:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 58cc52cf2 -> 681890238


AMBARI-12507. Add Service Wizard: when you add Oozie, HDFS and YARN are automatically shutdown
and restarted (alexantonenko)


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

Branch: refs/heads/branch-2.1
Commit: 681890238dc5feedee816d7e72da943ed2eac45e
Parents: 58cc52c
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Jul 22 22:34:17 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Jul 22 22:42:50 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  5 +-
 .../app/controllers/wizard/step8_controller.js  | 77 +++++++++++++++++---
 ambari-web/app/messages.js                      |  1 +
 .../test/controllers/wizard/step8_test.js       |  2 +
 4 files changed, 72 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/68189023/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 542b725..67fb944 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -1370,7 +1370,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   },
 
   showChangesWarningPopup: function(goToNextStep) {
-    var self = this;
     return App.ModalPopup.show({
       header: Em.I18n.t('common.warning'),
       body: Em.I18n.t('services.service.config.exitChangesPopup.body'),
@@ -1410,11 +1409,13 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin,
App.E
   showOozieDerbyWarningPopup: function(callback) {
     var self = this;
     if (this.get('selectedServiceNames').contains('OOZIE')) {
-      var databaseType = Em.getWithDefault(this.findConfigProperty('oozie_database', 'oozie-env.xml'),
'value', '');
+      var databaseType = Em.getWithDefault(this.findConfigProperty('oozie_database', 'oozie-env.xml')
|| {}, 'value', '');
       if (databaseType == Em.I18n.t('installer.step7.oozie.database.new')) {
         return App.ModalPopup.show({
           header: Em.I18n.t('common.warning'),
           body: Em.I18n.t('installer.step7.popup.oozie.derby.warning'),
+          secondary: Em.I18n.t('common.cancel'),
+          primary: Em.I18n.t('common.proceedAnyway'),
           onPrimary: function() {
             this.hide();
             if (callback) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/68189023/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index cc587e8..0c855c0 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -727,25 +727,80 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
    * @return {void}
    */
   submit: function () {
-    var self = this;
     var wizardController;
     if (!this.get('isSubmitDisabled')) {
       wizardController = App.router.get(this.get('content.controllerName'));
+      wizardController.setLowerStepsDisable(wizardController.get('currentStep'));
       this.set('isSubmitDisabled', true);
       this.set('isBackBtnDisabled', true);
-      wizardController.setLowerStepsDisable(wizardController.get('currentStep'));
-      if (this.get('content.controllerName') != 'installerController' && App.get('isKerberosEnabled')
&& !this.get('isManualKerberos')) {
-        App.get('router.mainAdminKerberosController').getKDCSessionState(this.submitProceed.bind(this),
function () {
-          self.set('isSubmitDisabled', false);
-          self.set('isBackBtnDisabled', false);
-          wizardController.setStepsEnable();
-          if (self.get('content.controllerName') === 'addServiceController') {
-            wizardController.setSkipSlavesStep(wizardController.getDBProperty('selectedServiceNames'),
3);
+      this.showRestartWarnings()
+        .then(this.checkKDCSession.bind(this));
+    }
+  },
+
+  /**
+   * Warn user about services that will be restarted during installation.
+   *
+   * @returns {$.Deferred}
+   */
+  showRestartWarnings: function() {
+    var self = this;
+    var dfd = $.Deferred();
+    var wizardController = App.router.get(this.get('content.controllerName'));
+    var selectedServiceNames = this.get('selectedServices').mapProperty('serviceName');
+    var installedServiceNames = this.get('installedServices').mapProperty('serviceName');
+
+    if (this.get('content.controllerName') === 'addServiceController' && selectedServiceNames.contains('OOZIE'))
{
+      var affectedServices = ['HDFS', 'YARN'].filter(function(serviceName) {
+        return installedServiceNames.contains(serviceName);
+      });
+      if (affectedServices.length) {
+        var serviceNames = affectedServices.length > 1 ?
+            '<b>{0}</b> {1} <b>{2}</b>'.format(affectedServices[0],
Em.I18n.t('and'), affectedServices[1]) : '<b>' + affectedServices[0] + '</b> ';
+        App.ModalPopup.show({
+          encodeBody: false,
+          header: Em.I18n.t('common.warning'),
+          body: Em.I18n.t('installer.step8.services.restart.required').format(serviceNames,
stringUtils.pluralize(affectedServices.length, Em.I18n.t('common.service').toLowerCase())),
+          secondary: Em.I18n.t('common.cancel'),
+          primary: Em.I18n.t('common.proceedAnyway'),
+          onPrimary: function() {
+            this.hide();
+            dfd.resolve();
+          },
+          onClose: function() {
+            this.hide();
+            self.set('isSubmitDisabled', false);
+            self.set('isBackBtnDisabled', false);
+            wizardController.setStepsEnable();
+            dfd.reject();
+          },
+          onSecondary: function() {
+            this.onClose();
           }
         });
       } else {
-        this.submitProceed();
+        dfd.resolve();
       }
+    } else {
+      dfd.resolve();
+    }
+    return dfd.promise();
+  },
+
+  checkKDCSession: function() {
+    var self = this;
+    var wizardController = App.router.get(this.get('content.controllerName'));
+    if (this.get('content.controllerName') != 'installerController' && App.get('isKerberosEnabled')
&& !this.get('isManualKerberos')) {
+      App.get('router.mainAdminKerberosController').getKDCSessionState(this.submitProceed.bind(this),
function () {
+        self.set('isSubmitDisabled', false);
+        self.set('isBackBtnDisabled', false);
+        wizardController.setStepsEnable();
+        if (self.get('content.controllerName') === 'addServiceController') {
+          wizardController.setSkipSlavesStep(wizardController.getDBProperty('selectedServiceNames'),
3);
+        }
+      });
+    } else {
+      this.submitProceed();
     }
   },
 
@@ -1696,7 +1751,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
App.wiz
 
       // exclude some configs if service wasn't selected
       var addProperty = optionalCoreSiteConfigs.every(function (config) {
-        var userValue = this.get('configs').someProperty('name', config.user) ? this.get('configs').findProperty('name',
config.user).value : null
+        var userValue = this.get('configs').someProperty('name', config.user) ? this.get('configs').findProperty('name',
config.user).value : null;
         return (installedAndSelectedServices.someProperty('serviceName', config.serviceName)
||
           (_coreSiteObj.name != 'hadoop.proxyuser.' + userValue + '.hosts' && _coreSiteObj.name
!= 'hadoop.proxyuser.' + userValue + '.groups'))
       }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/68189023/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 5aec091..b5b9c55 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -803,6 +803,7 @@ Em.I18n.translations = {
   'installer.step8.repoInfo.osType.redhat5':'RHEL 5/CentOS 5/Oracle Linux 5',
   'installer.step8.repoInfo.osType.sles11':'SLES 11/SUSE 11',
   'installer.step8.repoInfo.displayName':'Repositories',
+  'installer.step8.services.restart.required': '{0} {1} will be restarted during installation.',
   'installer.step9.header':'Install, Start and Test',
   'installer.step9.body':'Please wait while the selected services are installed and started.',
   'installer.step9.status.success':'Successfully installed and started the services.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/68189023/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index c7cf64a..e713e86 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -1455,10 +1455,12 @@ describe('App.WizardStep8Controller', function () {
   describe('#submit', function() {
     beforeEach(function() {
       sinon.stub(installerStep8Controller, 'submitProceed', Em.K);
+      sinon.stub(installerStep8Controller, 'showRestartWarnings').returns($.Deferred().resolve().promise());
       sinon.stub(App.get('router.mainAdminKerberosController'), 'getKDCSessionState', Em.K);
     });
     afterEach(function() {
       installerStep8Controller.submitProceed.restore();
+      installerStep8Controller.showRestartWarnings.restore();
       App.set('isKerberosEnabled', false);
       App.get('router.mainAdminKerberosController').getKDCSessionState.restore();
     });


Mime
View raw message