#401 Guard against `IndexError`.
Merged 4 years ago by jkaluza. Opened 4 years ago by ralph.
ralph/freshmaker errant-nvr  into  master

@@ -91,6 +91,10 @@ 

              r = requests.get(ERRATA_URL + "build/" + nvr, auth=krb_auth)

              r.raise_for_status()

              data = r.json()

+             if not data['all_errata']:

+                 # Super weird.  This means we have a container that wasn't shipped via an advisory.

+                 logging.warn("Failed to find errata for %s at %s" % (nvr, r.request.url))

+                 continue

              errata_id = data["all_errata"][0]["id"]

              errata_name = data["all_errata"][0]["name"]

              nvr_to_image_erratum[nvr] = errata_name
@@ -161,6 +165,8 @@ 

          # For each image (nvr) not built by Freshmaker, get the info about

          # advisory it was included in and add it to `advisories`.

          for nvr in non_freshmaker_nvrs:

+             if nvr not in nvr_to_image_erratum:

+                 continue

              errata_id, errata_name, products = nvr_to_image_erratum[nvr]

              if errata_name not in advisories:

                  freshmaker_url = is_content_advisory_rebuilt_by_freshmaker(

I found an instance here where the list was empty, and so trying to access the zeroeth element failed.

This handles that, and logs a warning.

Commit b3626ec fixes this pull-request

Pull-Request has been merged by jkaluza

4 years ago

Pull-Request has been merged by jkaluza

4 years ago