You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/12/04 16:57:36 UTC
ambari git commit: AMBARI-8543. Usability: After Deploy failure,
going back in the wizard to register hosts results in 0 host check
errors (even if there are errors) (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 61687ead9 -> a1b32f08e
AMBARI-8543. Usability: After Deploy failure, going back in the wizard to register hosts results in 0 host check errors (even if there are errors) (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a1b32f08
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a1b32f08
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a1b32f08
Branch: refs/heads/trunk
Commit: a1b32f08e4ef6643c3ec2e8e9b922a4d15453090
Parents: 61687ea
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Dec 4 16:59:41 2014 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Dec 4 17:57:33 2014 +0200
----------------------------------------------------------------------
.../app/assets/data/requests/host_check/1.json | 4 +-
.../app/controllers/wizard/step2_controller.js | 33 +-------
.../app/controllers/wizard/step3_controller.js | 49 ++++++++----
ambari-web/app/utils/ajax/ajax.js | 2 +-
.../test/controllers/wizard/step2_test.js | 82 +-------------------
.../test/controllers/wizard/step3_test.js | 81 ++++++++++++++++---
6 files changed, 111 insertions(+), 140 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1b32f08/ambari-web/app/assets/data/requests/host_check/1.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/requests/host_check/1.json b/ambari-web/app/assets/data/requests/host_check/1.json
index 4338bb5..c92a65e 100644
--- a/ambari-web/app/assets/data/requests/host_check/1.json
+++ b/ambari-web/app/assets/data/requests/host_check/1.json
@@ -18,7 +18,7 @@
"stderr": "",
"stdout": "",
"structured_out": {
- "host_resolution_check": {
+ "last_agent_env_check": {
"failures": [
{
"type": "FORWARD_LOOKUP",
@@ -57,7 +57,7 @@
"stderr": "",
"stdout": "",
"structured_out": {
- "host_resolution_check": {
+ "last_agent_env_check": {
"failed_count": "0",
"failures": [],
"success_count": "5"
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1b32f08/ambari-web/app/controllers/wizard/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step2_controller.js b/ambari-web/app/controllers/wizard/step2_controller.js
index ec82823..a4de17b 100644
--- a/ambari-web/app/controllers/wizard/step2_controller.js
+++ b/ambari-web/app/controllers/wizard/step2_controller.js
@@ -365,41 +365,12 @@ App.WizardStep2Controller = Em.Controller.extend({
return false;
}
- if (App.get('skipBootstrap')) {
- this.saveHosts();
- App.router.send('next');
- return true;
- }
- this.setupBootStrap();
+ this.saveHosts();
+ App.router.send('next');
return true;
},
/**
- * setup bootstrap data and completion callback for bootstrap call
- * @method setupBootStrap
- */
- setupBootStrap: function () {
- var self = this;
- var bootStrapData = JSON.stringify({
- 'verbose': true,
- 'sshKey': this.get('sshKey'),
- 'hosts': this.get('hostNameArr'),
- 'user': this.get('sshUser'),
- 'userRunAs': App.get('supports.customizeAgentUserAccount') ? this.get('agentUser') : 'root'
- });
- App.router.get(this.get('content.controllerName')).launchBootstrap(bootStrapData, function (requestId) {
- if (requestId == '0') {
- var controller = App.router.get(App.clusterStatus.wizardControllerName);
- controller.registerErrPopup(Em.I18n.t('common.information'), Em.I18n.t('installer.step2.evaluateStep.hostRegInProgress'));
- } else if (requestId) {
- self.set('content.installOptions.bootRequestId', requestId);
- self.saveHosts();
- App.router.send('next');
- }
- });
- },
-
- /**
* show warning for host names without dots or IP addresses
* @return {App.ModalPopup}
* @method warningPopup
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1b32f08/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 0513e42..7c044a5 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -171,7 +171,7 @@ App.WizardStep3Controller = Em.Controller.extend({
if (this.get('isLoaded')) {
if (!this.get('content.installOptions.manualInstall')) {
if (!this.get('wizardController').getDBProperty('bootStatus')) {
- this.startBootstrap();
+ this.setupBootStrap();
}
} else {
this.set('bootHosts', this.get('hosts'));
@@ -206,6 +206,30 @@ App.WizardStep3Controller = Em.Controller.extend({
},
/**
+ * setup bootstrap data and completion callback for bootstrap call
+ * @method setupBootStrap
+ */
+ setupBootStrap: function () {
+ var self = this;
+ var bootStrapData = JSON.stringify({
+ 'verbose': true,
+ 'sshKey': this.get('content.installOptions.sshKey'),
+ 'hosts': Em.keys(this.get('content.hosts')),
+ 'user': this.get('content.installOptions.sshUser'),
+ 'userRunAs': App.get('supports.customizeAgentUserAccount') ? this.get('agentUser') : 'root'
+ });
+ App.router.get(this.get('content.controllerName')).launchBootstrap(bootStrapData, function (requestId) {
+ if (requestId == '0') {
+ var controller = App.router.get(App.clusterStatus.wizardControllerName);
+ controller.registerErrPopup(Em.I18n.t('common.information'), Em.I18n.t('installer.step2.evaluateStep.hostRegInProgress'));
+ } else if (requestId) {
+ self.set('content.installOptions.bootRequestId', requestId);
+ self.startBootstrap();
+ }
+ });
+ },
+
+ /**
* Make basic init steps
* @method loadStep
*/
@@ -355,10 +379,8 @@ App.WizardStep3Controller = Em.Controller.extend({
this.set('numPolls', 0);
this.set('registrationStartedAt', null);
if (this.get('content.installOptions.manualInstall')) {
- this.get('bootHosts').setEach('bootStatus', 'DONE');
this.startRegistration();
- }
- else {
+ } else {
App.router.get(this.get('content.controllerName')).launchBootstrap(bootStrapData, function (requestId) {
self.set('content.installOptions.bootRequestId', requestId);
self.doBootstrap();
@@ -375,7 +397,7 @@ App.WizardStep3Controller = Em.Controller.extend({
this.set('isRetryDisabled', true);
var selectedHosts = this.get('bootHosts').filterProperty('bootStatus', 'FAILED');
selectedHosts.forEach(function (_host) {
- _host.set('bootStatus', 'RUNNING');
+ _host.set('bootStatus', 'DONE');
_host.set('bootLog', 'Retrying ...');
}, this);
this.retryHosts(selectedHosts);
@@ -595,7 +617,7 @@ App.WizardStep3Controller = Em.Controller.extend({
stopPolling = false;
break;
case 'REGISTERING':
- if (jsonData.items.someProperty('Hosts.host_name', _host.name)) {
+ if (jsonData.items.someProperty('Hosts.host_name', _host.name) && !jsonData.items.filterProperty('Hosts.host_name', _host.name).someProperty('Hosts.host_status', 'UNKNOWN')) {
_host.set('bootStatus', 'REGISTERED');
_host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + Em.I18n.t('installer.step3.hosts.bootLog.registering'));
} else {
@@ -715,7 +737,7 @@ App.WizardStep3Controller = Em.Controller.extend({
},
doCheckJDK: function () {
- var hostsNames = this.get('bootHosts').filterProperty('bootStatus', 'REGISTERED').getEach('name').join(",");
+ var hostsNames = (!this.get('content.installOptions.manualInstall')) ? this.get('bootHosts').filterProperty('bootStatus', 'REGISTERED').getEach('name').join(",") : this.get('bootHosts').getEach('name').join(",");
var javaHome = this.get('javaHome');
var jdkLocation = this.get('jdkLocation');
App.ajax.send({
@@ -826,16 +848,15 @@ App.WizardStep3Controller = Em.Controller.extend({
},
getHostNameResolution: function () {
- var hosts = this.get('bootHosts').filterProperty('bootStatus', 'REGISTERED').getEach('name').join(",");
+ var hosts = (!this.get('content.installOptions.manualInstall')) ? this.get('bootHosts').filterProperty('bootStatus', 'REGISTERED').getEach('name').join(",") : this.get('bootHosts').getEach('name').join(",");
var jdk_location = App.router.get('clusterController.ambariProperties.jdk_location');
var RequestInfo = {
"action": "check_host",
"context": "Check host",
"parameters": {
- "check_execute_list": "host_resolution_check",
+ "check_execute_list": "last_agent_env_check",
"jdk_location" : jdk_location,
- "threshold": "20",
- "hosts": hosts
+ "threshold": "20"
}
};
var resource_filters = {
@@ -908,14 +929,14 @@ App.WizardStep3Controller = Em.Controller.extend({
data.tasks.forEach(function (task) {
var name = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.error');
var hostInfo = this.get("hostCheckWarnings").findProperty('name', name);
- if (task.Tasks.status == "FAILED" || task.Tasks.status == "COMPLETED" || task.Tasks.status == "TIMEDOUT") {
+ if (["FAILED", "COMPLETED", "TIMEDOUT"].contains(task.Tasks.status)) {
if (task.Tasks.status == "COMPLETED") {
- if (Em.get(task, "Tasks.structured_out.host_resolution_check.failed_count") == 0) {
+ if (Em.get(task, "Tasks.structured_out.last_agent_env_check.failed_count") == 0) {
return;
}
}
var targetHostName = Em.get(task, "Tasks.host_name");
- var relatedHostNames = Em.get(task, "Tasks.structured_out.host_resolution_check.failures") ? Em.get(task, "Tasks.structured_out.host_resolution_check.failures").mapProperty('host') : [];
+ var relatedHostNames = Em.get(task, "Tasks.structured_out.last_agent_env_check.failures") ? Em.get(task, "Tasks.structured_out.last_agent_env_check.failures").mapProperty('host') : [];
var contextMessage = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.context').format(targetHostName, relatedHostNames.join(', '));
if (!hostInfo) {
hostInfo = {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1b32f08/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index ae91ab4..abd5c3a 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1567,7 +1567,7 @@ var urls = {
'mock': '/data/wizard/bootstrap/poll_{numPolls}.json'
},
'wizard.step3.is_hosts_registered': {
- 'real': '/hosts',
+ 'real': '/hosts?fields=Hosts/host_status',
'mock': '/data/wizard/bootstrap/single_host_registration.json'
},
'wizard.stacks': {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1b32f08/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index bb736ee..e244f85 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -452,16 +452,11 @@ describe('App.WizardStep2Controller', function () {
expect(c.manualInstallPopup.calledOnce).to.equal(true);
});
- it ('should save hosts and proceed next if skipBootstrap is true', function() {
- sinon.stub(App, 'get', function(k) {
- if ('skipBootstrap' === k) {
- return true;
- }
- return Em.get(App, k);
- });
+ it ('should save hosts and proceed next if manualInstall is false', function() {
sinon.stub(App.router, 'send', Em.K);
c.reopen({
hostNameArr: ['h1'],
+ manualInstall: false,
isAllHostNamesValid: function() {return true;},
content: {
installOptions: {},
@@ -472,33 +467,9 @@ describe('App.WizardStep2Controller', function () {
expect(r).to.equal(true);
expect(Em.keys(c.get('content.hosts'))).to.eql(['h1']);
expect(App.router.send.calledWith('next')).to.equal(true);
- App.get.restore();
App.router.send.restore();
});
- it('should call setupBootStrap', function() {
- sinon.stub(App, 'get', function(k) {
- if ('skipBootstrap' === k) {
- return false;
- }
- return Em.get(App, k);
- });
- c.reopen({
- hostNameArr: ['h1'],
- isAllHostNamesValid: function() {return true;},
- content: {
- installOptions: {},
- hosts: null
- }
- });
- sinon.stub(c, 'setupBootStrap', Em.K);
- var r = c.proceedNext();
- expect(r).to.equal(true);
- expect(c.setupBootStrap.calledOnce).to.eql(true);
- App.get.restore();
- c.setupBootStrap.restore();
- });
-
});
describe('#isSubmitDisabled', function () {
@@ -687,53 +658,4 @@ describe('App.WizardStep2Controller', function () {
});
});
- describe('#setupBootStrap', function () {
-
- var cases = [
- {
- customizeAgentUserAccount: true,
- userRunAs: 'user',
- title: 'Ambari Agent user account customize enabled'
- },
- {
- customizeAgentUserAccount: false,
- userRunAs: 'root',
- title: 'Ambari Agent user account customize disabled'
- }
- ],
- controller = App.WizardStep2Controller.create({
- sshKey: 'key',
- hostNameArr: ['host0', 'host1'],
- sshUser: 'root',
- agentUser: 'user',
- content: {
- controllerName: 'installerController'
- }
- });
-
- beforeEach(function () {
- sinon.spy(App.router.get('installerController'), 'launchBootstrap');
- });
-
- afterEach(function () {
- App.router.get('installerController.launchBootstrap').restore();
- App.get.restore();
- });
-
- cases.forEach(function (item) {
- it(item.title, function () {
- sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
- controller.setupBootStrap();
- expect(App.router.get('installerController.launchBootstrap').firstCall.args[0]).to.equal(JSON.stringify({
- verbose: true,
- sshKey: 'key',
- hosts: ['host0', 'host1'],
- user: 'root',
- userRunAs: item.userRunAs
- }));
- });
- });
-
- });
-
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1b32f08/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 11033cd..522f60b 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -487,10 +487,14 @@ describe('App.WizardStep3Controller', function () {
});
agentUserCases.forEach(function (item) {
it(item.title, function () {
- var controller = App.WizardStep2Controller.create({
- sshKey: 'key',
- hostNameArr: ['host0', 'host1'],
- sshUser: 'root',
+ var controller = App.WizardStep3Controller.create({
+ content: {
+ installOptions: {
+ sshKey: 'key',
+ sshUser: 'root'
+ },
+ hosts: { "host0": { "name": "host0" }, "host1": { "name": "host1" } }
+ },
agentUser: 'user'
});
sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
@@ -1522,38 +1526,38 @@ describe('App.WizardStep3Controller', function () {
describe('#navigateStep', function() {
beforeEach(function(){
- sinon.stub(c, 'startBootstrap', Em.K);
+ sinon.stub(c, 'setupBootStrap', Em.K);
});
afterEach(function(){
- c.startBootstrap.restore();
+ c.setupBootStrap.restore();
});
Em.A([
{
isLoaded: true,
manualInstall: false,
bootStatus: false,
- m: 'should call startBootstrap',
+ m: 'should call setupBootStrap',
e: true
},
{
isLoaded: true,
manualInstall: false,
bootStatus: true,
- m: 'shouldn\'t call startBootstrap (1)',
+ m: 'shouldn\'t call setupBootStrap (1)',
e: false
},
{
isLoaded: false,
manualInstall: false,
bootStatus: false,
- m: 'shouldn\'t call startBootstrap (2)',
+ m: 'shouldn\'t call setupBootStrap (2)',
e: false
},
{
isLoaded: false,
manualInstall: true,
bootStatus: false,
- m: 'shouldn\'t call startBootstrap (3)',
+ m: 'shouldn\'t call setupBootStrap (3)',
e: false
}
]).forEach(function(test) {
@@ -1574,10 +1578,10 @@ describe('App.WizardStep3Controller', function () {
});
c.navigateStep();
if(test.e) {
- expect(c.startBootstrap.calledOnce).to.equal(true);
+ expect(c.setupBootStrap.calledOnce).to.equal(true);
}
else {
- expect(c.startBootstrap.called).to.equal(false);
+ expect(c.setupBootStrap.called).to.equal(false);
}
});
});
@@ -1634,6 +1638,59 @@ describe('App.WizardStep3Controller', function () {
});
+ describe('#setupBootStrap', function () {
+
+ var cases = [
+ {
+ customizeAgentUserAccount: true,
+ userRunAs: 'user',
+ title: 'Ambari Agent user account customize enabled'
+ },
+ {
+ customizeAgentUserAccount: false,
+ userRunAs: 'root',
+ title: 'Ambari Agent user account customize disabled'
+ }
+ ],
+
+
+ controller = App.WizardStep3Controller.create({
+ content: {
+ installOptions: {
+ sshKey: 'key',
+ sshUser: 'root'
+ },
+ hosts: { "host0": { "name": "host0" }, "host1": { "name": "host1" } },
+ controllerName: 'installerController'
+ },
+ agentUser: 'user'
+ });
+
+ beforeEach(function () {
+ sinon.spy(App.router.get('installerController'), 'launchBootstrap');
+ });
+
+ afterEach(function () {
+ App.router.get('installerController.launchBootstrap').restore();
+ App.get.restore();
+ });
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
+ controller.setupBootStrap();
+ expect(App.router.get('installerController.launchBootstrap').firstCall.args[0]).to.equal(JSON.stringify({
+ verbose: true,
+ sshKey: 'key',
+ hosts: ['host0', 'host1'],
+ user: 'root',
+ userRunAs: item.userRunAs
+ }));
+ });
+ });
+
+ });
+
describe('#checkHostDiskSpace', function() {
Em.A([
{