فهرست منبع

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

Alex Antonenko 10 سال پیش
والد
کامیت
3a59642b4c

+ 3 - 2
ambari-web/app/controllers/wizard/step7_controller.js

@@ -1340,7 +1340,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'),
@@ -1380,11 +1379,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) {

+ 66 - 11
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);

+ 1 - 0
ambari-web/app/messages.js

@@ -804,6 +804,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.',

+ 2 - 0
ambari-web/test/controllers/wizard/step8_test.js

@@ -1454,10 +1454,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();
     });