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 E44BE200BF6 for ; Tue, 10 Jan 2017 15:50:12 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E2EF6160B4D; Tue, 10 Jan 2017 14:50:12 +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 415D7160B3D for ; Tue, 10 Jan 2017 15:50:12 +0100 (CET) Received: (qmail 43289 invoked by uid 500); 10 Jan 2017 14:50:11 -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 43191 invoked by uid 99); 10 Jan 2017 14:50:11 -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; Tue, 10 Jan 2017 14:50:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4E1E7DFB7D; Tue, 10 Jan 2017 14:50:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akovalenko@apache.org To: commits@ambari.apache.org Date: Tue, 10 Jan 2017 14:50:12 -0000 Message-Id: In-Reply-To: <24eb72f42e2f492cb363037660a2d48f@git.apache.org> References: <24eb72f42e2f492cb363037660a2d48f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] ambari git commit: AMBARI-19014. Add Service Wizard: error thrown during transition on deploy step (akovalenko) archived-at: Tue, 10 Jan 2017 14:50:13 -0000 AMBARI-19014. Add Service Wizard: error thrown during transition on deploy step (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0722e544 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0722e544 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0722e544 Branch: refs/heads/branch-2.5 Commit: 0722e5445125b65070e15f465ff99bdacd4c2248 Parents: ea6c376 Author: Aleksandr Kovalenko Authored: Tue Nov 29 15:27:22 2016 +0200 Committer: Aleksandr Kovalenko Committed: Tue Jan 10 16:46:41 2017 +0200 ---------------------------------------------------------------------- .../controllers/main/service/add_controller.js | 11 +++++--- .../main/service/add_controller_test.js | 29 ++++++++++++++++---- 2 files changed, 30 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0722e544/ambari-web/app/controllers/main/service/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js index 4310f8d..f312a5a 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -467,7 +467,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { installSelectedServices: function (callback) { var name = 'common.services.update'; var selectedServices = this.get('content.services').filterProperty('isInstalled', false).filterProperty('isSelected', true).mapProperty('serviceName'); - var dependentServices = this.getDependentServices(); + var dependentServices = this.getServicesBySelectedSlaves(); var data = this.generateDataForInstallServices(selectedServices.concat(dependentServices)); this.installServicesRequest(name, data, callback.bind(this)); }, @@ -484,14 +484,17 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { }, /** - * return list of services by dependent slave components + * return list of services by selected and not installed slave components * @returns {Array} */ - getDependentServices: function () { + getServicesBySelectedSlaves: function () { var result = []; this.get('content.slaveComponentHosts').forEach(function (slaveComponent) { if (slaveComponent.hosts.someProperty('isInstalled', false)) { - result.push(App.StackServiceComponent.find().findProperty('componentName', slaveComponent.componentName).get('serviceName')); + var stackComponent = App.StackServiceComponent.find().findProperty('componentName', slaveComponent.componentName); + if (stackComponent) { + result.push(stackComponent.get('serviceName')); + } } }); return result.uniq(); http://git-wip-us.apache.org/repos/asf/ambari/blob/0722e544/ambari-web/test/controllers/main/service/add_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js index 7470f89..715f46a 100644 --- a/ambari-web/test/controllers/main/service/add_controller_test.js +++ b/ambari-web/test/controllers/main/service/add_controller_test.js @@ -566,14 +566,14 @@ describe('App.AddServiceController', function() { }); - describe('#getDependentServices', function () { + describe('#getServicesBySelectedSlaves', function () { beforeEach(function () { sinon.stub(App.StackServiceComponent, 'find').returns([ - Em.Object.create({ - componentName: 'c1', - serviceName: 's1' - }), + Em.Object.create({ + componentName: 'c1', + serviceName: 's1' + }), Em.Object.create({ componentName: 'c2', serviceName: 's2' @@ -596,6 +596,23 @@ describe('App.AddServiceController', function() { expect: [] }, { + title: 'should return empty array if component is absent in StackServiceComponent model', + sch: [ + { + componentName: 'c5', + hosts: [ + { + isInstalled: false + }, + { + isInstalled: true + } + ] + }, + ], + expect: [] + }, + { title: 'should return services for not installed slaves', sch: [ { @@ -638,7 +655,7 @@ describe('App.AddServiceController', function() { describe(test.title, function () { it(function () { addServiceController.set('content.slaveComponentHosts', test.sch); - expect(addServiceController.getDependentServices()).to.eql(test.expect); + expect(addServiceController.getServicesBySelectedSlaves()).to.eql(test.expect); }); }) });