This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a7ac282  [AMBARI-23942] Invalid repo url displayed on Ambari UI during 
service… (#1364)
a7ac282 is described below

commit a7ac282e4c6b26cad34eae7ccff4cf67260e407e
Author: Ishan Bhatt <[email protected]>
AuthorDate: Thu May 24 10:47:45 2018 -0700

    [AMBARI-23942] Invalid repo url displayed on Ambari UI during service… 
(#1364)
    
    * [AMBARI-23942] Invalid repo url displayed on Ambari UI during service 
installation
    
    * remove commented out code
---
 ambari-web/app/controllers/wizard/step8_controller.js | 14 +++++++++++---
 ambari-web/test/controllers/wizard/step8_test.js      | 15 +++++----------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/ambari-web/app/controllers/wizard/step8_controller.js 
b/ambari-web/app/controllers/wizard/step8_controller.js
index 578c337..5fcb0cc 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -331,9 +331,17 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
    */
   loadRepoInfo: function () {
     var stackName = App.get('currentStackName');
-    var currentStackVersionNumber = App.get('currentStackVersionNumber');
-    var currentStackVersion = App.StackVersion.find().filterProperty('stack', 
stackName).findProperty('version', currentStackVersionNumber);
-    var currentRepoVersion = 
currentStackVersion.get('repositoryVersion.repositoryVersion');
+
+    var currentRepoVersion;
+    App.RepositoryVersion.find().forEach(function (repoVersion) {
+      if (repoVersion.get('stackVersionType') === stackName && 
repoVersion.get('isCurrent') && repoVersion.get('isStandard')) {
+        currentRepoVersion = repoVersion.get('repositoryVersion');
+      }
+    });
+
+    if (!currentRepoVersion) {
+      console.error('Error while getting current stack repository version');
+    }
 
     return App.ajax.send({
       name: 'cluster.load_repo_version',
diff --git a/ambari-web/test/controllers/wizard/step8_test.js 
b/ambari-web/test/controllers/wizard/step8_test.js
index 790b807..7512e08 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -653,21 +653,16 @@ describe('App.WizardStep8Controller', function () {
   describe('#loadRepoInfo', function() {
 
     beforeEach(function () {
-      var stubForGet = sinon.stub(App, 'get');
-      stubForGet.withArgs('currentStackName').returns('HDP');
-      stubForGet.withArgs('currentStackVersionNumber').returns('2.3');
-      sinon.stub(App.StackVersion, 'find', function() {
-        return [
-          Em.Object.create({state: 'NOT_CURRENT', stack: 'HDP', version: 
'2.3', repositoryVersion: {repositoryVersion: '2.3.0.0-2208'}})
-        ];
-      });
+      var stubForGet = sinon.stub(App, 
'get').withArgs('currentStackName').returns('HDP');
+      this.mockRepo = sinon.stub(App.RepositoryVersion, 'find');
     });
 
     afterEach(function () {
       App.get.restore();
-      App.StackVersion.find.restore();
+      App.RepositoryVersion.find.restore();
     });
-    it('should use current StackVersion', function() {
+    it('should return repo', function() {
+      this.mockRepo.returns([Em.Object.create({stackVersionType: 'HDP', 
isCurrent: true, isStandard: true, repositoryVersion: '2.3.0.0-2208'})])
       installerStep8Controller.loadRepoInfo();
       var args = testHelpers.findAjaxRequest('name', 
'cluster.load_repo_version');
       expect(args[0].data).to.eql({stackName: 'HDP', repositoryVersion: 
'2.3.0.0-2208'});

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to