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 2AA6E200BA7 for ; Fri, 21 Oct 2016 20:53:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 292CE160AE9; Fri, 21 Oct 2016 18:53:18 +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 49F7E160ADE for ; Fri, 21 Oct 2016 20:53:17 +0200 (CEST) Received: (qmail 34611 invoked by uid 500); 21 Oct 2016 18:53:16 -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 34602 invoked by uid 99); 21 Oct 2016 18:53:16 -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, 21 Oct 2016 18:53:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4C485F0DC2; Fri, 21 Oct 2016 18:53:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alexantonenko@apache.org To: commits@ambari.apache.org Date: Fri, 21 Oct 2016 18:53:16 -0000 Message-Id: <0585e97de6504d5dbb32de1ac004d014@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] ambari git commit: AMBARI-18662. Check that Stack Version and repo URLs match up when registering repo (alexantonenko) archived-at: Fri, 21 Oct 2016 18:53:18 -0000 Repository: ambari Updated Branches: refs/heads/trunk 5114bc9f7 -> 00f1e71b6 AMBARI-18662. Check that Stack Version and repo URLs match up when registering repo (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/00f1e71b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/00f1e71b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/00f1e71b Branch: refs/heads/trunk Commit: 00f1e71b62f4133e70d7d8f9f2cd6fa0624ec40d Parents: db8f3e3 Author: Alex Antonenko Authored: Fri Oct 21 17:13:40 2016 +0300 Committer: Alex Antonenko Committed: Fri Oct 21 21:53:10 2016 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/installer.js | 3 ++- .../app/controllers/wizard/step1_controller.js | 21 +++++++++++++++++++- ambari-web/app/messages.js | 2 ++ ambari-web/test/controllers/installer_test.js | 13 +++++++----- 4 files changed, 32 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/00f1e71b/ambari-web/app/controllers/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js index e2c60c4..f736ba3 100644 --- a/ambari-web/app/controllers/installer.js +++ b/ambari-web/app/controllers/installer.js @@ -841,6 +841,7 @@ App.InstallerController = App.WizardController.extend({ selectedStack.get('operatingSystems').forEach(function (os) { if (os.get('isSelected') && !os.get('isEmpty')) { os.get('repositories').forEach(function (repo) { + if (!repo.get('isUtils') && wizardStep1Controller.inappropriateUrlForStackVersion(repo, stackVersion)) return; repo.setProperties({ errorTitle: '', errorContent: '', @@ -888,8 +889,8 @@ App.InstallerController = App.WizardController.extend({ } } this.set('validationCnt', this.get('validationCnt') - 1); + this.set('content.isCheckInProgress', false); if (!this.get('validationCnt')) { - this.set('content.isCheckInProgress', false); data.dfd.resolve(); } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/00f1e71b/ambari-web/app/controllers/wizard/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step1_controller.js b/ambari-web/app/controllers/wizard/step1_controller.js index e1cb4ff..6c105c2 100644 --- a/ambari-web/app/controllers/wizard/step1_controller.js +++ b/ambari-web/app/controllers/wizard/step1_controller.js @@ -272,6 +272,25 @@ App.WizardStep1Controller = Em.Controller.extend({ this.selectStackBy('id', event.context.get('id')); }, + inappropriateUrlForStackVersion: function (repo, stackVersion) { + var baseUrl = repo.get('baseUrl'), + splittedBaseUrlArray = baseUrl.split('/'), + versionInUrl = baseUrl[baseUrl.length - 1] === '/' ? splittedBaseUrlArray[splittedBaseUrlArray.length - 2] : + splittedBaseUrlArray[splittedBaseUrlArray.length - 1], + versionInUrlString = String(parseFloat(versionInUrl)), + UrlIsInvalidForStackVersion = versionInUrlString !== stackVersion; + + if (UrlIsInvalidForStackVersion) { + repo.setProperties({ + validation: App.Repository.validation.INVALID, + errorTitle: Em.I18n.t("installer.step1.error.inappropriateUrlForStackVersion.title"), + errorContent: Em.I18n.t("installer.step1.error.inappropriateUrlForStackVersion.content").format(stackVersion, versionInUrlString) + }); + } + + return UrlIsInvalidForStackVersion; + }, + /** * Show popup with options to upload new version * @@ -444,7 +463,7 @@ App.WizardStep1Controller = Em.Controller.extend({ enterUrlRadioButton: Em.Checkbox.extend({ attributeBindings: [ 'type', 'checked' ], checked: Em.computed.alias('controller.optionsToSelect.useLocalRepo.enterUrl.isSelected'), - type: 'radio', + type: 'radio' }), click: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/00f1e71b/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index a3c5e58..b27e8f5 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -627,6 +627,8 @@ Em.I18n.translations = { 'installer.step1.invalidURLAttention': 'Attention: Please make sure all repository URLs are valid before proceeding.', 'installer.step1.checkAtLeastOneAttention': 'Attention: Please check at least one repository.', 'installer.step1.retryRepoUrls': 'Click here to retry.', + 'installer.step1.error.inappropriateUrlForStackVersion.title':'Inappropriate Url for selected Stack Version', + 'installer.step1.error.inappropriateUrlForStackVersion.content': 'Your stack version is {0} when version in Url is {1}', 'installer.step2.header':'Install Options', 'installer.step2.body':'Enter the list of hosts to be included in the cluster and provide your SSH key.', http://git-wip-us.apache.org/repos/asf/ambari/blob/00f1e71b/ambari-web/test/controllers/installer_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js index 441af87..63578bc 100644 --- a/ambari-web/test/controllers/installer_test.js +++ b/ambari-web/test/controllers/installer_test.js @@ -75,8 +75,8 @@ describe('App.InstallerController', function () { Em.Object.create({ isSelected: true, reload: false, - id: 'nn-cc', - stackNameVersion: 'nn-cc', + id: 'nn-2.5', + stackNameVersion: 'nn-2.5', repositories: Em.A([ Em.Object.create({ isSelected: true, @@ -89,6 +89,7 @@ describe('App.InstallerController', function () { isEmpty: false, repositories: Em.A([ Em.Object.create({ + baseUrl: 'url/2.5', isEmpty: false, errorTitle: '1', errorContent: '1', @@ -100,7 +101,8 @@ describe('App.InstallerController', function () { }) ]); var wizard = Em.Object.create({ - skipValidationChecked: true + skipValidationChecked: true, + inappropriateUrlForStackVersion: App.WizardStep1Controller.create().inappropriateUrlForStackVersion }); it ('Should reload installed stacks', function() { @@ -114,8 +116,8 @@ describe('App.InstallerController', function () { { "isSelected": true, "reload": true, - "id": "nn-cc", - "stackNameVersion": 'nn-cc', + "id": "nn-2.5", + "stackNameVersion": 'nn-2.5', "repositories": [ { "isSelected": true, @@ -128,6 +130,7 @@ describe('App.InstallerController', function () { "isEmpty": false, "repositories": [ { + "baseUrl": "url/2.5", "isEmpty": false, "errorTitle": "", "errorContent": "",