Updated Branches:
  refs/heads/trunk 220294d55 -> 12ac556f4

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


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

Branch: refs/heads/trunk
Commit: 12ac556f4476c1b9107d889ede78417060663660
Parents: 220294d
Author: Aleksandr Kovalenko <[email protected]>
Authored: Fri Nov 1 20:15:13 2013 +0200
Committer: Aleksandr Kovalenko <[email protected]>
Committed: Fri Nov 1 20:15:13 2013 +0200

----------------------------------------------------------------------
 .../admin/highAvailability/progress_controller.js     | 14 +++++++++++---
 .../main/service/reassign/step4_controller.js         | 10 +++++++++-
 .../main/service/reassign/step6_controller.js         | 10 +++++++++-
 3 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/12ac556f/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js 
b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 25fa8a1..032f5f0 100644
--- 
a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ 
b/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)) {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/12ac556f/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/service/reassign/step4_controller.js 
b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index 6134086..3af54e2 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/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('[email protected]', this, 'onTaskStatusChange');

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/12ac556f/ambari-web/app/controllers/main/service/reassign/step6_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/service/reassign/step6_controller.js 
b/ambari-web/app/controllers/main/service/reassign/step6_controller.js
index 3efc638..c5f9218 100644
--- a/ambari-web/app/controllers/main/service/reassign/step6_controller.js
+++ b/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();
+    }
   }
 })

Reply via email to