Browse Source

AMBARI-4967: Security wizard: Start all services call should wait for the result of Delete ATS component call. (jaimin)

Jaimin Jetly 11 năm trước cách đây
mục cha
commit
6799d16f68

+ 35 - 0
ambari-web/app/controllers/main/admin/security/add/step4.js

@@ -22,6 +22,7 @@ App.MainAdminSecurityAddStep4Controller = App.MainAdminSecurityProgressControlle
   name: 'mainAdminSecurityAddStep4Controller',
 
   serviceUsersBinding: 'App.router.mainAdminSecurityController.serviceUsers',
+  totalSteps: 4,
 
   secureServices: function() {
     return  this.get('content.services');
@@ -63,6 +64,15 @@ App.MainAdminSecurityAddStep4Controller = App.MainAdminSecurityProgressControlle
     this.get('serviceConfigTags').clear();
   },
 
+  loadStages: function () {
+    this.get('stages').pushObjects([
+      App.Poll.create({stage: 'stage2', label: Em.I18n.translations['admin.addSecurity.apply.stage2'], isPolling: true, name: 'STOP_SERVICES', isVisible: true}),
+      App.Poll.create({stage: 'stage3', label: Em.I18n.translations['admin.addSecurity.apply.stage3'], isPolling: false, name: 'APPLY_CONFIGURATIONS', isVisible: true}),
+      App.Poll.create({stage: 'stage5', label: Em.I18n.translations['admin.addSecurity.apply.delete.ats'], isPolling: false, name: 'DELETE_ATS', isVisible: false}),
+      App.Poll.create({stage: 'stage4', label: Em.I18n.translations['admin.addSecurity.apply.stage4'], isPolling: true, name: 'START_SERVICES', isVisible: true})
+    ]);
+  },
+
   loadStep: function () {
     this.set('secureMapping', require('data/secure_mapping').slice(0));
     this.clearStep();
@@ -371,6 +381,31 @@ App.MainAdminSecurityAddStep4Controller = App.MainAdminSecurityProgressControlle
     return true;
   },
 
+  deleteComponents: function(componentName, hostName) {
+    App.ajax.send({
+      name: 'admin.delete_component',
+      sender: this,
+      data: {
+        componentName: componentName,
+        hostName: hostName
+      },
+      success: 'onDeleteComplete',
+      error: 'onDeleteError'
+    });
+  },
+
+  onDeleteComplete: function () {
+    var deleteAtsStage = this.get('stages').findProperty('name', 'DELETE_ATS');
+    console.warn('APP_TIMELINE_SERVER doesn\'t support security mode. It has been removed from YARN service ');
+    deleteAtsStage.set('isError', false);
+    deleteAtsStage.set('isSuccess', true);
+  },
+
+  onDeleteError: function () {
+    console.warn('Error: Can\'t delete APP_TIMELINE_SERVER');
+  },
+
+
   onJsError: function () {
     App.ModalPopup.show({
       header: Em.I18n.t('common.error'),

+ 14 - 29
ambari-web/app/controllers/main/admin/security/security_progress_controller.js

@@ -39,7 +39,6 @@ App.MainAdminSecurityProgressController = Em.Controller.extend({
   serviceConfigTags: [],
   globalProperties: [],
   totalSteps: 3,
-
   isSubmitDisabled: true,
 
 
@@ -95,15 +94,9 @@ App.MainAdminSecurityProgressController = Em.Controller.extend({
         currentStage = startedStages.findProperty('isCompleted', false);
       }
       if (currentStage && currentStage.get('isPolling') === true) {
-        if (currentStage.get('name') === 'START_SERVICES' && !App.router.get('addSecurityController.securityEnabled')) {
-          var timeLineServer = App.Service.find('YARN').get('hostComponents').findProperty('componentName', 'APP_TIMELINE_SERVER');
-          if (timeLineServer) {
-            this.deleteComponents('APP_TIMELINE_SERVER', timeLineServer.get('host.hostName'));
-          }
-        }
         currentStage.set('isStarted', true);
         currentStage.start();
-      } else if (currentStage && currentStage.get('stage') === 'stage3') {
+      } else if (currentStage && currentStage.get('name') === 'APPLY_CONFIGURATIONS') {
         currentStage.set('isStarted', true);
         if (App.testMode) {
           currentStage.set('isError', false);
@@ -111,10 +104,22 @@ App.MainAdminSecurityProgressController = Em.Controller.extend({
         } else {
           this.loadClusterConfigs();
         }
+      } else if (currentStage && currentStage.get('name') === 'DELETE_ATS') {
+        currentStage.set('isStarted', true);
+        if (App.testMode) {
+          currentStage.set('isError', false);
+          currentStage.set('isSuccess', true);
+        } else {
+          var timeLineServer = App.Service.find('YARN').get('hostComponents').findProperty('componentName', 'APP_TIMELINE_SERVER');
+          if (timeLineServer && !App.router.get('mainAdminSecurityController.securityEnabled')) {
+            this.deleteComponents('APP_TIMELINE_SERVER', timeLineServer.get('host.hostName'));
+          }
+        }
       }
     }
   },
 
+
   onCompleteStage: function () {
     if (this.get('stages').length === this.totalSteps) {
       var index = this.get('stages').filterProperty('isSuccess', true).length;
@@ -168,27 +173,6 @@ App.MainAdminSecurityProgressController = Em.Controller.extend({
     });
   },
 
-  deleteComponents: function(componentName, hostName) {
-    App.ajax.send({
-      name: 'admin.delete_component',
-      sender: this,
-      data: {
-        componentName: componentName,
-        hostName: hostName
-      },
-      success: 'onDeleteComplete',
-      error: 'onDeleteError'
-    });
-  },
-
-  onDeleteComplete: function () {
-    console.warn('APP_TIMELINE_SERVER doesn\'t support security mode. It has been removed from YARN service ');
-  },
-
-  onDeleteError: function () {
-    console.warn('Error: Can\'t delete APP_TIMELINE_SERVER');
-  },
-
   loadClusterConfigsSuccessCallback: function (data) {
     var self = this;
     //prepare tags to fetch all configuration for a service
@@ -347,6 +331,7 @@ App.MainAdminSecurityProgressController = Em.Controller.extend({
           stage: _stage.get('stage'),
           label: _stage.get('label'),
           isPolling: _stage.get('isPolling'),
+          isVisible:  _stage.get('isVisible'),
           isStarted: _stage.get('isStarted'),
           requestId: _stage.get('requestId'),
           isSuccess: _stage.get('isSuccess'),

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

@@ -937,6 +937,7 @@ Em.I18n.translations = {
   'admin.addSecurity.apply.stage3': '2. Save Configurations',
   'admin.addSecurity.apply.stage4': '3. Start Services',
   'admin.addSecurity.apply.stage5': '5. Smoke Test',
+  'admin.addSecurity.apply.delete.ats': 'Delete ATS',
   'admin.addSecurity.user.smokeUser': 'Ambari Smoke Test User',
   'admin.addSecurity.user.hdfsUser': 'HDFS User',
   'admin.addSecurity.user.hbaseUser': 'HBase User',

+ 22 - 19
ambari-web/app/templates/main/service/reconfigure.hbs

@@ -18,14 +18,15 @@
 
 <table id="security-stages" class="table no-borders">
   <tbody>
-    {{#each stage in controller.stages}}
-    <tr>
-      <td>
-      {{#view App.StageLabelView stageBinding="stage"}}
-          <p {{bindAttr class="view.isStarted::faintText"}}>{{stage.label}}</p>
-      {{/view}}
-      </td>
-      <td>
+  {{#each stage in controller.stages}}
+    {{#if stage.isVisible}}
+      <tr>
+        <td>
+          {{#view App.StageLabelView stageBinding="stage"}}
+            <p {{bindAttr class="view.isStarted::faintText"}}>{{stage.label}}</p>
+          {{/view}}
+        </td>
+        <td>
           {{#if stage.isCompleted}}
             {{#if stage.isSuccess}}
               {{view App.StageSuccessView}}
@@ -44,16 +45,18 @@
               {{/if}}
             {{/if}}
           {{/if}}
-      </td>
-      <td>
-        {{#if stage.isError}}
-          <a class="btn btn-primary"
-             href="javascript:void(null)" {{action retry target = "controller"}}><i class="icon-repeat icon-white"></i>
-            {{t common.retry}}
-          </a>
-        {{/if}}
-      </td>
-    </tr>
-    {{/each}}
+        </td>
+        <td>
+          {{#if stage.isError}}
+            <a class="btn btn-primary"
+               href="javascript:void(null)" {{action retry target = "controller"}}><i
+                    class="icon-repeat icon-white"></i>
+              {{t common.retry}}
+            </a>
+          {{/if}}
+        </td>
+      </tr>
+    {{/if}}
+  {{/each}}
   </tbody>
 </table>

+ 1 - 0
ambari-web/app/utils/polling.js

@@ -21,6 +21,7 @@ App.Poll = Em.Object.extend({
   name: '',
   stage: '',
   label: '',
+  isVisible: true,
   isStarted: false,
   isPolling: true,
   clusterName: null,