You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by lp...@apache.org on 2017/08/22 11:48:05 UTC
[37/51] [abbrv] ambari git commit: AMBARI-21718. Unable to remove
ZooKeeper on heartbeat lost hosts. (Ishan Bhatt via Jaimin)
AMBARI-21718. Unable to remove ZooKeeper on heartbeat lost hosts. (Ishan Bhatt via Jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d6908446
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d6908446
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d6908446
Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d69084461998ad33c233bb33734b7935681df086
Parents: 15aa037
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Mon Aug 21 12:12:50 2017 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Mon Aug 21 12:14:13 2017 -0700
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 32 ++++++++---
ambari-web/app/messages.js | 4 +-
.../test/controllers/main/host/details_test.js | 59 ++++++++++++++------
3 files changed, 69 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6908446/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index abf7673..cf223d7 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2490,6 +2490,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
zkServerInstalled: false,
lastComponents: [],
masterComponents: [],
+ nonAddableMasterComponents: [],
+ lastMasterComponents: [],
runningComponents: [],
nonDeletableComponents: [],
unknownComponents: [],
@@ -2500,12 +2502,22 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
if (cInstance.get('componentName') === 'ZOOKEEPER_SERVER') {
container.zkServerInstalled = true;
}
+ var isLastComponent = false;
if (this.getTotalComponent(cInstance) === 1) {
container.lastComponents.push(cInstance.get('displayName'));
+ isLastComponent = true;
}
var workStatus = cInstance.get('workStatus');
+
if (cInstance.get('isMaster')) {
- container.masterComponents.push(cInstance.get('displayName'));
+ var displayName = cInstance.get('displayName')
+ container.masterComponents.push(displayName);
+ if (!App.StackServiceComponent.find(cInstance.get('componentName')).get('isMasterAddableInstallerWizard')) {
+ container.nonAddableMasterComponents.push(displayName);
+ }
+ if(isLastComponent) {
+ container.lastMasterComponents.push(displayName);
+ }
}
if (stoppedStates.indexOf(workStatus) < 0) {
container.runningComponents.push(cInstance.get('displayName'));
@@ -2650,16 +2662,20 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
validateAndDeleteHost: function () {
var container = this.getHostComponentsInfo();
- if (container.masterComponents.length > 0) {
- this.raiseDeleteComponentsError(container, 'masterList');
- return;
- } else if (container.nonDeletableComponents.length > 0) {
+ if (container.nonDeletableComponents.length > 0) {
this.raiseDeleteComponentsError(container, 'nonDeletableList');
return;
+ } else if (container.nonAddableMasterComponents.length > 0) {
+ this.raiseDeleteComponentsError(container, 'masterList');
+ return;
} else if (container.runningComponents.length > 0) {
this.raiseDeleteComponentsError(container, 'runningList');
return;
+ } else if(container.lastMasterComponents.length > 0) {
+ this.raiseDeleteComponentsError(container, 'lastMasterList');
+ return;
}
+
if (container.zkServerInstalled) {
var self = this;
return App.showConfirmationPopup(function () {
@@ -2680,17 +2696,19 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
App.ModalPopup.show({
header: Em.I18n.t('hosts.cant.do.popup.title'),
type: type,
- showBodyEnd: Em.computed.existsIn('type', ['runningList', 'masterList']),
+ showBodyEnd: Em.computed.existsIn('type', ['runningList', 'masterList', 'lastMasterList']),
container: container,
components: function(){
var container = this.get('container');
switch (this.get('type')) {
case 'masterList':
- return container.masterComponents;
+ return container.nonAddableMasterComponents;
case 'nonDeletableList':
return container.nonDeletableComponents;
case 'runningList':
return container.runningComponents;
+ case 'lastMasterList':
+ return container.lastMasterComponents;
}
}.property('type'),
componentsStr: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6908446/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index f75d801..87a5e97 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2761,11 +2761,13 @@ Em.I18n.translations = {
'hosts.delete.popup.unknownComponents':'The following components have unknown status:',
'hosts.cant.do.popup.title':'Unable to Delete Host',
'hosts.cant.do.popup.masterList.body':'This host cannot be deleted since it has the following master components:',
- 'hosts.cant.do.popup.masterList.body.end':'To delete this host, you must first move or delete all the master components listed above.',
+ 'hosts.cant.do.popup.masterList.body.end':'To delete this host, you must first move all the master components listed above.',
'hosts.cant.do.popup.nonDeletableList.body':'Deletion of the following {0} components is not supported. ',
'hosts.cant.do.popup.runningList.body':'This host cannot be deleted since the following components are running:',
'hosts.cant.do.popup.runningList.body.end':'To delete this host, you must first stop all the running components listed above. ' +
'If this host has a {0}, it should be decommissioned first to prevent data loss.',
+ 'hosts.cant.do.popup.lastMasterList.body':'This host cannot be deleted since the following master components do not have any other instances:',
+ 'hosts.cant.do.popup.lastMasterList.body.end':'To delete this host, you must first add all the components listed above to other hosts',
'hosts.add.header':'Add Host Wizard',
'hosts.add.exit.header':'Exit',
'hosts.add.exit.body':'Do you really want to exit Add Host Wizard?',
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6908446/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 34794f7..f9df36d 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -1994,6 +1994,8 @@ describe('App.MainHostDetailsController', function () {
zkServerInstalled: false,
lastComponents: [],
masterComponents: [],
+ nonAddableMasterComponents: [],
+ lastMasterComponents: [],
runningComponents: [],
nonDeletableComponents: [],
unknownComponents: [],
@@ -2118,82 +2120,103 @@ describe('App.MainHostDetailsController', function () {
controller.confirmDeleteHost.restore();
});
- it('masterComponents exist', function () {
+ it('nonDeletableComponents exist', function () {
controller.set('mockHostComponentsInfo', {
- masterComponents: [
+ nonDeletableComponents: [
{}
]
});
controller.validateAndDeleteHost();
- expect(controller.raiseDeleteComponentsError.calledWith({masterComponents: [
- {}
- ]}, 'masterList')).to.be.true;
- });
- it('nonDeletableComponents exist', function () {
- controller.set('mockHostComponentsInfo', {
- masterComponents: [],
+ expect(controller.raiseDeleteComponentsError.calledWith({
nonDeletableComponents: [
{}
]
+ }, 'nonDeletableList')).to.be.true;
+ });
+ it('nonAddableMasterComponents exist', function () {
+ controller.set('mockHostComponentsInfo', {
+ nonDeletableComponents: [],
+ nonAddableMasterComponents: [
+ {}
+ ]
});
controller.validateAndDeleteHost();
expect(controller.raiseDeleteComponentsError.calledWith({
- masterComponents: [],
- nonDeletableComponents: [
+ nonDeletableComponents: [],
+ nonAddableMasterComponents: [
{}
]
- }, 'nonDeletableList')).to.be.true;
+ }, 'masterList')).to.be.true;
});
it('runningComponents exist', function () {
controller.set('mockHostComponentsInfo', {
- masterComponents: [],
+ nonAddableMasterComponents: [],
nonDeletableComponents: [],
runningComponents: [{}]
});
controller.validateAndDeleteHost();
expect(controller.raiseDeleteComponentsError.calledWith({
- masterComponents: [],
+ nonAddableMasterComponents: [],
nonDeletableComponents: [],
runningComponents: [{}]
}, 'runningList')).to.be.true;
});
+ it('lastMasterComponents exist', function () {
+ controller.set('mockHostComponentsInfo', {
+ nonAddableMasterComponents: [],
+ nonDeletableComponents: [],
+ runningComponents: [],
+ lastMasterComponents: [{}]
+ });
+ controller.validateAndDeleteHost();
+ expect(controller.raiseDeleteComponentsError.calledWith({
+ nonAddableMasterComponents: [],
+ nonDeletableComponents: [],
+ runningComponents: [],
+ lastMasterComponents: [{}]
+ }, 'lastMasterList')).to.be.true;
+ });
it('zkServerInstalled = true', function () {
controller.set('mockHostComponentsInfo', {
- masterComponents: [],
+ nonAddableMasterComponents: [],
nonDeletableComponents: [],
runningComponents: [],
unknownComponents: [],
lastComponents: [],
+ lastMasterComponents: [],
zkServerInstalled: true
});
var popup = controller.validateAndDeleteHost();
expect(App.showConfirmationPopup.calledOnce).to.be.true;
popup.onPrimary();
expect(controller.confirmDeleteHost.calledWith({
- masterComponents: [],
+ nonAddableMasterComponents: [],
nonDeletableComponents: [],
runningComponents: [],
unknownComponents: [],
lastComponents: [],
+ lastMasterComponents: [],
zkServerInstalled: true
})).to.be.true;
});
it('zkServerInstalled = false', function () {
controller.set('mockHostComponentsInfo', {
- masterComponents: [],
+ nonAddableMasterComponents: [],
nonDeletableComponents: [],
runningComponents: [],
unknownComponents: [],
lastComponents: [],
+ lastMasterComponents: [],
zkServerInstalled: false
});
controller.validateAndDeleteHost();
expect(controller.confirmDeleteHost.calledWith({
- masterComponents: [],
+ nonAddableMasterComponents: [],
nonDeletableComponents: [],
runningComponents: [],
unknownComponents: [],
lastComponents: [],
+ lastMasterComponents: [],
zkServerInstalled: false
})).to.be.true;
});