Uploaded image for project: 'Ambari (Retired)'
  1. Ambari (Retired)
  2. AMBARI-19637

No baseURL field on Register Version page if repoinfo.xml contains only one baseurl

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.5.0
    • None
    • ambari-admin
    • None

    Description

      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

      <reposinfo>
        <os family="redhat6">
          <repo>
            <baseurl>http://foo</baseurl>
            <repoid>PERF-1.0</repoid>
            <reponame>PERF</reponame>
            <unique>true</unique>
          </repo>
        </os>
      </reposinfo>

      errors in console

      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)

      The hardcoded index is here:

      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
            };
          });

      Attachments

        1. AMBARI-19637.patch
          5 kB
          Richard Zang

        Issue Links

          Activity

            People

              rzang Richard Zang
              rzang Richard Zang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: