Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1897306

Summary: podman does not support {{ index .Id }} queries and so all containers are restarted at each redeploy
Product: Red Hat OpenStack Reporter: Michele Baldessari <michele>
Component: python-paunchAssignee: Alex Schultz <aschultz>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: medium Docs Contact:
Priority: high    
Version: 16.1 (Train)CC: aschultz, jhajyahy
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-paunch-5.3.3-1.20200826193408.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-17 15:35:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1881476    
Bug Blocks:    

Description Michele Baldessari 2020-11-12 18:14:37 UTC
Description of problem:
Via https://review.opendev.org/#/c/752937/ 
(https://bugzilla.redhat.com/show_bug.cgi?id=1881476) we added the following code:
       if container_image:
            image_id_str = self.runner.inspect(
                container_image, "{{index .Id}}", o_type='image')
            if str(image_id_str).strip() != inspect_info.get('Image'):
                self.log.debug("Deleting container (image updated): "
                               "%s" % container)
                self.runner.remove_container(container)
                return True

This code works fine in docker:
[root@controller-0 ~]# docker inspect --type image --format '{{index .Id}}' f6ec0f326154     
sha256:f6ec0f326154a80b6844a03c2de2904bbbefea6cdf87acb606ff869ace1a8dd4                      
                     
But is problematic in podman (both on 1.6.4 and 2.1.1 versions):
[root@controller-0 ~]# podman inspect --type image --format '{{index .Id}}' undercloud-0.ctlplane.redhat.local:8787/rh-osbs/rhosp16-openstack-cinder-volume:16.2_20201110.2-hotfixupdate2
ERRO[0000] Error printing inspect output: Template parsing error: template: image:1:8: executing "image" at <.Id>: can't evaluate field Id in type *entities.ImageInspectReport    

This has the side-effect of restarting all containers at each identical redeploy.      

We can just drop the 'index' in the query since it works in both docker and podman:
[root@controller-0 ~]# docker inspect --type image --format '{{.Id}}' f6ec0f326154           
sha256:f6ec0f326154a80b6844a03c2de2904bbbefea6cdf87acb606ff869ace1a8dd4 

[root@controller-0 ~]# podman inspect --type image --format '{{.Id}}' 5093412f3a08 
5093412f3a0860090fc19ff2e6aa766e6270a3d277f78661f2117f58c8a20994

Comment 5 Jad Haj Yahya 2021-01-25 08:55:26 UTC
sudo podman inspect --type image --format '{{.Id}}' c326625253f4

Comment 13 errata-xmlrpc 2021-03-17 15:35:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform 16.1.4 director bug fix advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:0817