Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 01199200B38 for ; Fri, 8 Jul 2016 22:30:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F3C54160A5A; Fri, 8 Jul 2016 20:30:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 212CF160A36 for ; Fri, 8 Jul 2016 22:30:26 +0200 (CEST) Received: (qmail 67454 invoked by uid 500); 8 Jul 2016 20:30:26 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 67445 invoked by uid 99); 8 Jul 2016 20:30:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jul 2016 20:30:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E6CBADFFF8; Fri, 8 Jul 2016 20:30:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jaimin@apache.org To: commits@ambari.apache.org Message-Id: <961389469d37465588a6bbdc321fca88@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-17580. Ambari-web unable to automatically add MASTER component with cardinality ALL on all nodes. (Shantanu Mundkur via Jaimin) Date: Fri, 8 Jul 2016 20:30:25 +0000 (UTC) archived-at: Fri, 08 Jul 2016 20:30:28 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.4 43785d418 -> e873a685f AMBARI-17580. Ambari-web unable to automatically add MASTER component with cardinality ALL on all nodes. (Shantanu Mundkur via Jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e873a685 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e873a685 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e873a685 Branch: refs/heads/branch-2.4 Commit: e873a685f00eab72cbd3d86f15d977db85354762 Parents: 43785d4 Author: Jaimin Jetly Authored: Fri Jul 8 13:33:33 2016 -0700 Committer: Jaimin Jetly Committed: Fri Jul 8 13:33:33 2016 -0700 ---------------------------------------------------------------------- .../app/controllers/wizard/step8_controller.js | 4 +- .../test/controllers/wizard/step8_test.js | 98 +++++++++++++++++++- 2 files changed, 99 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e873a685/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index f5c92ec..0ad68ed 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -1155,7 +1155,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz if (masterOnAllHosts.length > 0) { var compOnAllHosts = false; for (var i=0; i < masterOnAllHosts.length; i++) { - if (component.component_name == masterOnAllHosts[i]) { + if (component == masterOnAllHosts[i]) { compOnAllHosts = true; break; } @@ -1227,7 +1227,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz if (slaveOnAllHosts.length > 0) { var compOnAllHosts = false; for (var i=0; i < slaveOnAllHosts.length; i++) { - if (_slave.component_name == slaveOnAllHosts[i]) { + if (_slave.componentName == slaveOnAllHosts[i]) { // component with ALL cardinality should not // registerHostsToComponent in createSlaveAndClientsHostComponents compOnAllHosts = true; http://git-wip-us.apache.org/repos/asf/ambari/blob/e873a685/ambari-web/test/controllers/wizard/step8_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js index 6bad1fb..9214631 100644 --- a/ambari-web/test/controllers/wizard/step8_test.js +++ b/ambari-web/test/controllers/wizard/step8_test.js @@ -1540,7 +1540,103 @@ describe('App.WizardStep8Controller', function () { }); }); - describe('should not add components with isRequiredOnAllHosts == false (2)', function() { + describe('should add components with isRequiredOnAllHosts == true (2)', function() { + + beforeEach(function () { + installerStep8Controller.reopen({ + getRegisteredHosts: function() { + return [{hostName: 'h1'}, {hostName: 'h2'}]; + }, + content: { + services: Em.A([ + Em.Object.create({ + serviceName: 'ANYSERVICE', isSelected: true, isInstalled: false, serviceComponents: [ + // set isRequiredOnAllHosts = true for master + Em.Object.create({ + componentName: 'ANYSERVICE_MASTER', + isMaster: true, + isRequiredOnAllHosts: true + }), + Em.Object.create({ + componentName: 'ANYSERVICE_SLAVE', + isSlave: true, + isRequiredOnAllHosts: false + }), + Em.Object.create({ + componentName: 'ANYSERVICE_SLAVE2', + isSlave: true, + isRequiredOnAllHosts: false + }), + Em.Object.create({ + componentName: 'ANYSERVICE_CLIENT', + isClient: true, + isRequiredOnAllHosts: false + }) + ] + }) + ]), + masterComponentHosts: Em.A([ + Em.Object.create({ + componentName: 'ANYSERVICE_MASTER', + component: 'ANYSERVICE_MASTER', + hosts: Em.A([ + Em.Object.create({hostName: 'h1', isInstalled: true}) + ]) + }) + ]), + slaveComponentHosts: Em.A([ + Em.Object.create({ + componentName: 'ANYSERVICE_SLAVE', + hosts: Em.A([ + Em.Object.create({hostName: 'h1', isInstalled: false}), + Em.Object.create({hostName: 'h2', isInstalled: false}) + ]) + }), + Em.Object.create({ + componentName: 'ANYSERVICE_SLAVE2', + hosts: Em.A([ + Em.Object.create({hostName: 'h1', isInstalled: false}), + Em.Object.create({hostName: 'h2', isInstalled: false}) + ]) + }), + Em.Object.create({ + componentName: 'CLIENT', + hosts: Em.A([ + Em.Object.create({hostName: 'h1', isInstalled: false}), + Em.Object.create({hostName: 'h2', isInstalled: false}) + ]) + }) + ]), + clients: Em.A([ + Em.Object.create({ + component_name: 'ANYSERVICE_CLIENT', + isInstalled: false, + hosts: Em.A([ + Em.Object.create({hostName: 'h1', isInstalled: false}), + Em.Object.create({hostName: 'h2', isInstalled: false}) + ]) + }) + ]) + } + }); + installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create()); + installerStep8Controller.get('ajaxRequestsQueue').clear(); + installerStep8Controller.createMasterHostComponents(); + installerStep8Controller.createAdditionalHostComponents(); + }); + + // master component with isRequiredOnAllHosts = true implies that + // registerHostsToComponent would be done via + // createAdditionalHostComponents() BUT NOT + // createMasterHostComponents() + it('registerHostsToComponent 1st call', function () { + expect(installerStep8Controller.registerHostsToComponent.args[0][0]).to.eql(['h1', 'h2']); + expect(installerStep8Controller.registerHostsToComponent.args[0][1]).to.equal('ANYSERVICE_MASTER'); + expect(installerStep8Controller.registerHostsToComponent.callCount).to.equal(1); + }); + }); + + describe('should not add components with isRequiredOnAllHosts == false (3)', function() { beforeEach(function () { installerStep8Controller.reopen({