You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/03/05 22:45:19 UTC
git commit: AMBARI-4946. Installer wizard: Error handling for failed
Start all services call. (jaimin)
Repository: ambari
Updated Branches:
refs/heads/trunk d69423807 -> 5fca4800d
AMBARI-4946. Installer wizard: Error handling for failed Start all services call. (jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5fca4800
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5fca4800
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5fca4800
Branch: refs/heads/trunk
Commit: 5fca4800dbecc7ac0eb22b810378a99b1be285d4
Parents: d694238
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Wed Mar 5 13:44:28 2014 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Wed Mar 5 13:44:58 2014 -0800
----------------------------------------------------------------------
.../app/controllers/wizard/step9_controller.js | 38 ++++++++++++++---
ambari-web/app/messages.js | 1 +
ambari-web/app/utils/ajax.js | 10 ++---
ambari-web/app/views/wizard/step9_view.js | 4 +-
ambari-web/test/installer/step9_test.js | 45 +++++++++++++++++++-
5 files changed, 85 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5fca4800/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index 5554fde..d84ed93 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -80,6 +80,9 @@ App.WizardStep9Controller = Em.Controller.extend({
*/
hostsWithHeartbeatLost: [],
+ // Flag is set in the start all services error callback function
+ startCallFailed: false,
+
/*
* Status of the page. Possible values: <info, warning, failed and success>.
* This property is used in the step-9 view for displaying the appropriate color of the overall progress bar and
@@ -253,7 +256,9 @@ App.WizardStep9Controller = Em.Controller.extend({
*/
updateStatus: function () {
var status = 'info';
- if (this.get('hosts').someProperty('status', 'failed') || this.get('hosts').someProperty('status', 'heartbeat_lost')) {
+ if (this.get('hosts').someProperty('status', 'failed')
+ || this.get('hosts').someProperty('status', 'heartbeat_lost')
+ || this.get('startCallFailed')) {
status = 'failed';
} else if (this.get('hosts').someProperty('status', 'warning')) {
if (this.isStepFailed()) {
@@ -326,6 +331,7 @@ App.WizardStep9Controller = Em.Controller.extend({
clearStep: function () {
this.get('hosts').clear();
this.set('hostsWithHeartbeatLost', []);
+ this.set('startCallFailed',false);
this.set('status', 'info');
this.set('progress', '0');
this.set('numPolls', 1);
@@ -589,14 +595,36 @@ App.WizardStep9Controller = Em.Controller.extend({
/**
* Error callback function for start services task.
*/
- launchStartServicesErrorCallback: function () {
+ launchStartServicesErrorCallback: function (jqXHR) {
console.log("ERROR");
+ this.set('startCallFailed',true);
var clusterStatus = {
- status: 'START FAILED',
- isStartError: true,
+ status: 'INSTALL FAILED',
+ isStartError: false,
isCompleted: false
};
- App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
+ if (App.testMode) {
+ this.set('content.cluster', clusterStatus);
+ } else {
+ App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
+ }
+ this.get('hosts').forEach(function (host) {
+ host.set('progress', '100');
+ });
+ this.set('progress','100');
+
+ var params = {
+ cluster: this.get('content.cluster.name')
+ };
+
+ if (this.get('content.controllerName') === 'addHostController') {
+ params.name = 'wizard.step9.add_host.launch_start_services';
+ } else {
+ params.name = 'wizard.step9.installer.launch_start_services';
+ }
+
+ var opt = App.formatRequest.call(App.urls[params.name], params);
+ App.ajax.defaultErrorHandler(jqXHR,opt.url,opt.type);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/5fca4800/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 5189006..03dfb6b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -572,6 +572,7 @@ Em.I18n.translations = {
'installer.step9.status.success':'Successfully installed and started the services.',
'installer.step9.status.warning':'Installed and started the services with some warnings.',
'installer.step9.status.failed':'Failed to install/start the services.',
+ 'installer.step9.status.start.services.failed':'Start all services API call failed.',
'installer.step9.status.install.components.failed': 'Some service components are still not known to have installed successfully. Please Retry',
'installer.step9.status.hosts.heartbeat_lost': 'Ambari agent is not runnig on {0} host.',
'installer.step9.host.heartbeat_lost': 'Heartbeat lost for the host',
http://git-wip-us.apache.org/repos/asf/ambari/blob/5fca4800/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 9c39793..a48ac92 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -1825,18 +1825,14 @@ var ajax = Em.Object.extend({
method = method || 'GET';
var self = this;
var api = " received on " + method + " method for API: " + url;
- var showMessage = true;
try {
var json = $.parseJSON(jqXHR.responseText);
var message = json.message;
} catch (err) {
}
- if (showStatus === null) {
+ if (!showStatus) {
showStatus = 500;
}
- if (message === undefined) {
- showMessage = false;
- }
var statusCode = jqXHR.status + " status code";
if (jqXHR.status === showStatus && !this.modalPopup) {
this.modalPopup = App.ModalPopup.show({
@@ -1852,7 +1848,7 @@ var ajax = Em.Object.extend({
api: api,
statusCode: statusCode,
message: message,
- showMessage: showMessage
+ showMessage: !!message
})
});
}
@@ -1905,3 +1901,5 @@ if ($.mocho) {
}
App.ajax = ajax.create({});
+App.formatRequest = formatRequest;
+App.urls = urls;
http://git-wip-us.apache.org/repos/asf/ambari/blob/5fca4800/ambari-web/app/views/wizard/step9_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step9_view.js b/ambari-web/app/views/wizard/step9_view.js
index f265b43..4adb5d8 100644
--- a/ambari-web/app/views/wizard/step9_view.js
+++ b/ambari-web/app/views/wizard/step9_view.js
@@ -65,6 +65,8 @@ App.WizardStep9View = Em.View.extend({
// When present requests succeeds but some host components are in UNKNOWN or INSTALL_FAILED state and
// hosts are in HEARTBEAT_LOST state
this.set('resultMsg', Em.I18n.t('installer.step9.status.hosts.heartbeat_lost').format(this.get('controller.hostsWithHeartbeatLost').length));
+ } else if (this.get('controller.startCallFailed')) {
+ this.set('resultMsg', Em.I18n.t('installer.step9.status.start.services.failed'));
} else {
this.set('resultMsg', Em.I18n.t('installer.step9.status.failed'));
}
@@ -74,7 +76,7 @@ App.WizardStep9View = Em.View.extend({
this.set('resultMsg', Em.I18n.t('installer.step9.status.success'));
this.set('resultMsgColor', 'alert-success');
}
- }.observes('controller.status', 'isHostHeartbeatLost'),
+ }.observes('controller.status', 'controller.startCallFailed','isHostHeartbeatLost'),
hostWithInstallFailed: function (event, context) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5fca4800/ambari-web/test/installer/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/installer/step9_test.js b/ambari-web/test/installer/step9_test.js
index 6529bf3..bd760e8 100644
--- a/ambari-web/test/installer/step9_test.js
+++ b/ambari-web/test/installer/step9_test.js
@@ -1121,7 +1121,50 @@ describe('App.InstallerStep9Controller', function () {
});
});
});
-
})
+ // On completion of Start all services error callback function,
+ // Cluster Status should be INSTALL FAILED
+ // All progress bar on the screen should be finished (100%) with blue color.
+ // Retry button should be enabled, next button should be disabled
+
+ describe('#launchStartServicesErrorCallback', function () {
+ App.testMode = true;
+ // override the actual function
+ App.popup = {
+ setErrorPopup: function() {
+ return true;
+ }
+ };
+ var hosts = Em.A([Em.Object.create({name: 'host1', progress: '33', status: 'info'}),Em.Object.create({name: 'host2', progress: '33', status: 'info'})]);
+ var controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController', cluster: {status: 'PENDING',name: 'c1'}},togglePreviousSteps: function(){}});
+
+ //Action
+ controller.launchStartServicesErrorCallback({status:500, statusTesxt: 'Server Error'});
+ it('Cluster Status should be INSTALL FAILED', function () {
+ expect(controller.get('content.cluster.status')).to.equal('INSTALL FAILED');
+ });
+
+ it('Main progress bar on the screen should be finished (100%) with red color', function () {
+ expect(controller.get('progress')).to.equal('100');
+ expect(controller.get('status')).to.equal('failed');
+ });
+
+ it('All Host progress bars on the screen should be finished (100%) with blue color', function () {
+ controller.get('hosts').forEach(function(host){
+ expect(host.get('progress')).to.equal('100');
+ expect(host.get('status')).to.equal('info');
+ });
+ });
+
+ it('Next button should be disabled', function () {
+ expect(controller.get('isSubmitDisabled')).to.equal(true);
+ });
+
+ it('Retry button should be visible', function () {
+ expect(controller.get('showRetry')).to.equal(true);
+ })
+
+ });
+
});