Richard Zang created AMBARI-19637:
-------------------------------------

             Summary: No baseURL field on Register Version page if repoinfo.xml 
contains only one baseurl
                 Key: AMBARI-19637
                 URL: https://issues.apache.org/jira/browse/AMBARI-19637
             Project: Ambari
          Issue Type: Bug
          Components: ambari-admin
    Affects Versions: 2.5.0
            Reporter: Richard Zang
            Assignee: Richard Zang


The issue here is that if repoinfo.xml declares only one repo url per os 
family, then UI fails  with list index out bounds error

*repoinfo.xml*
{code}<reposinfo>
  <os family="redhat6">
    <repo>
      <baseurl>http://foo</baseurl>
      <repoid>PERF-1.0</repoid>
      <reponame>PERF</reponame>
      <unique>true</unique>
    </repo>
  </os>
</reposinfo>{code}

errors in console 
{code}TypeError: Cannot read property 'Repositories' of undefined
    at 
http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/main.js:4560:44
    at Array.forEach (native)
    at Scope.$scope.setVersionSelected 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/main.js:4557:42)
    at 
http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/main.js:4669:16
    at wrappedCallback 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:23340:81)
    at 
http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:23426:26
    at Scope.$eval 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:24469:28)
    at Scope.$digest 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:24281:31)
    at Scope.$apply 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:24573:24)
    at done 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:20146:45)(anonymous
 function) @ vendor.js:21839
6vendor.js:21839 TypeError: Cannot read property 'Repositories' of undefined
    at 
http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/main.js:4560:44
    at Array.forEach (native)
    at Scope.$scope.setVersionSelected 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/main.js:4557:42)
    at Scope.$scope.onStackIdChange 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/main.js:4578:12)
    at 
http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:22614:21
    at callback 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:30903:17)
    at Scope.$eval 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:24469:28)
    at Scope.$apply 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:24567:23)
    at HTMLLIElement.<anonymous> 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:30908:23)
    at HTMLLIElement.jQuery.event.dispatch 
(http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/2.5.0.0/INSTANCE/scripts/vendor.js:4737:27){code}


The hardcoded index is here:
{code}response.updateObj.operating_systems.forEach(function(os) {
      $scope.defaulfOSRepos[os.OperatingSystems.os_type] = {
        defaultBaseUrl: os.repositories[0].Repositories.base_url,
        defaultUtilsUrl: os.repositories[1].Repositories.base_url
      };
    });{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to