#82 find_parent_images_with_package stops at an intermediate layer and can't find parent image
Closed: Fixed Opened by cqi.

As per title, here is an example call,

In [7]: lb.find_parent_images_with_package('python-rhsm', [
           "sha256:3341bdf8e8f4fe50a6db58c8c98cf607fa04290e8b1e5351ef017852b8e36168",
           "sha256:5fc16d069eee79ef0a1b438ba2dae55328eab7d68a63c155bd8dfbeb0e4e587e",
           "sha256:5d181d25ef0f6e5ee710eb56d3b4abe4c0d138dca466281d580bb989e6ad6992",
           "sha256:274f5cdf1187c4ae217ecc996ad131cfbb58eb1e906e58d6dd581b16ff8fd6e7",
           "sha256:3ca89bad9e1bf45baa6e74e6c762372e44510063a5564a6b2bc201ebb0ecae0e",
           "sha256:77ed333d2fd1036ad5aea8c21eb5b0275f46336b90cdb65d07b85c0ca44a147a",
           "sha256:e2ec004b8762abcf3899582660ad1139de428bd2c536c32270f2a26f4c1fc873"
        ])
('Get parent image: ', 'sha256:5fc16d069eee79ef0a1b438ba2dae55328eab7d68a63c155bd8dfbeb0e4e587e')
Out[7]: []

I inserted print statement in for loop in method find_parent_images_with_package to output each parent layer hash. As we can see, find_parent_images_with_package stops at the first "parent image".

However, there is a parent image rhel-server-docker-7.1-6 actually, whose top layer is sha256:e2ec004b8762abcf3899582660ad1139de428bd2c536c32270f2a26f4c1fc873.


This can happen if there is a missing image in lightblue. i.e. the call to get_image_by_layer will return None. If lightblue has no image where sha256:5fc16d069eee79ef0a1b438ba2dae55328eab7d68a63c155bd8dfbeb0e4e587e layer is top-most it will assume the current image is "base".

What I would suggest - basically in all these cases, if we can't find any parent image but number of layers is more than 2 this is almost certainly a problem in the LB data so we could detect it.

Metadata Update from @cqi:
- Issue assigned to cqi

PR: https://pagure.io/freshmaker/pull-request/85

Metadata Update from @ralph:
- Issue close_status updated to: Fixed

Metadata