Add image id compare

If the image has been updated on disk, the podman_container isn't
rebuild to use the new container.  This change adds an image id check to
the image check to see if the image name and tag are the same but the id
of the image has changed. It should be noted that the podman_container
does not fetch the updated image as it simply checks if it exists. A
user needs to use podman_image with force: True prior to running
podman_container to hit this condition.

Change-Id: Icb718d1c1ea9b829a532c37844ffb3c8b5db5dbe
Related-Bug: #1895974
This commit is contained in:
Alex Schultz 2020-09-21 09:23:45 -06:00
parent 327c72413c
commit 804d0ae51e
1 changed files with 7 additions and 1 deletions

View File

@ -1568,7 +1568,13 @@ class PodmanContainerDiff:
after = after.replace(":latest", "")
before = before.split("/")[-1]
after = after.split("/")[-1]
return self._diff_update_and_compare('image', before, after)
# the image in the config has changed (e.g. new tag)
if self._diff_update_and_compare('image', before, after):
return True
# compare image id on disk to container to see if the image has been updated
before = self.info['image']
after = self.image_info['id']
return self._diff_update_and_compare('image_id', before, after)
def diffparam_ipc(self):
before = self.info['hostconfig']['ipcmode']