Преглед изворни кода

AMBARI-3668. Reassign Master: Parse create component resource and delete component resource request response on failure. (akovalenko)

Aleksandr Kovalenko пре 11 година
родитељ
комит
12ac556f44

+ 11 - 3
ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js

@@ -265,11 +265,11 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
           taskNum: hostName.length
         },
         success: 'onCreateComponent',
-        error: 'onTaskError'
+        error: 'onCreateComponentError'
       });
       } else {
-        var taskNum = hostName.length;
-        this.installComponent(componentName, hostName[i], taskNum);
+        // Simulates format returned from ajax.send
+        this.onCreateComponent(null, null, {hostName: componentName, componentName: hostName[i], taskNum: hostName.length});
       }
     }
   },
@@ -282,6 +282,14 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
     this.installComponent(componentName, hostName, taskNum);
   },
 
+  onCreateComponentError: function (error) {
+    if (error.responseText.indexOf('org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException') !== -1) {
+      this.onCreateComponent();
+    } else {
+      this.onTaskError();
+    }
+  },
+
   installComponent: function (componentName, hostName, taskNum) {
     console.warn('func: installComponent');
     if (!(hostName instanceof Array)) {

+ 9 - 1
ambari-web/app/controllers/main/service/reassign/step4_controller.js

@@ -338,11 +338,19 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
           componentName: hostComponents[i]
         },
         success: 'onComponentsTasksSuccess',
-        error: 'onTaskError'
+        error: 'onDeleteHostComponentsError'
       });
     }
   },
 
+  onDeleteHostComponentsError: function (error) {
+    if (error.responseText.indexOf('org.apache.ambari.server.controller.spi.NoSuchResourceException') !== -1) {
+      this.onComponentsTasksSuccess();
+    } else {
+      this.onTaskError();
+    }
+  },
+
   done: function () {
     if (!this.get('isSubmitDisabled')) {
       this.removeObserver('tasks.@each.status', this, 'onTaskStatusChange');

+ 9 - 1
ambari-web/app/controllers/main/service/reassign/step6_controller.js

@@ -101,8 +101,16 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro
           componentName: hostComponents[i]
         },
         success: 'onComponentsTasksSuccess',
-        error: 'onTaskError'
+        error: 'onDeleteHostComponentsError'
       });
     }
+  },
+
+  onDeleteHostComponentsError: function (error) {
+    if (error.responseText.indexOf('org.apache.ambari.server.controller.spi.NoSuchResourceException') !== -1) {
+      this.onComponentsTasksSuccess();
+    } else {
+      this.onTaskError();
+    }
   }
 })