Bug 2132361 - [RFE] python-podman: Podman support to perform custom actions on unhealthy containers [rhel-8.6.0.z]
Summary: [RFE] python-podman: Podman support to perform custom actions on unhealthy co...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: python-podman
Version: 8.6
Hardware: Unspecified
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: Jindrich Novy
QA Contact: Alex Jia
URL:
Whiteboard:
Depends On: 2131741
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-10-05 12:02 UTC by RHEL Program Management Team
Modified: 2022-12-06 13:53 UTC (History)
21 users (show)

Fixed In Version: python-podman-4.0.1-1.el8
Doc Type: Enhancement
Doc Text:
Clone Of: 2131741
Environment:
Last Closed: 2022-10-25 09:33:30 UTC
Type: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-135717 0 None None None 2022-10-05 12:23:28 UTC
Red Hat Product Errata RHBA-2022:7127 0 None None None 2022-10-25 09:33:45 UTC

Comment 1 Tom Sweeney 2022-10-05 19:00:27 UTC
@ddarrah can I get a qa ack please?

Comment 2 Tom Sweeney 2022-10-05 19:02:18 UTC
PR: https://github.com/containers/podman-py/pull/211 from Charlie Doern

Comment 3 Tom Sweeney 2022-10-05 20:58:13 UTC
@ddarrah can I get a QA ack here please?

Comment 4 Jindrich Novy 2022-10-06 06:35:03 UTC
Strangely enough I don't see https://github.com/containers/podman-py/pull/211 merged into https://github.com/containers/podman-py/tree/v4.0.0-rhel even though github on the PR is saying so. The last commit in v4.0.0-rhel branch is from Brent - 28th Feb. Charlie, can you please check?

Comment 5 Charlie Doern 2022-10-06 11:58:22 UTC
The 4.0.0-rhel branch has a 4.0.1 tag. I M trying to keep with the podman-py convention of tagging a release rather than having it be the last commit of a branch.

Comment 6 Charlie Doern 2022-10-06 12:37:22 UTC
I have updated the branching and tags properly, the release is now representative of the 4.0.0-rhel branch. @jnovy please let me know what else you need

Comment 7 Tom Sweeney 2022-10-06 15:11:39 UTC
Setting to Post and assigning to @jnovy for any further packaging and BZ needs.  

The release is ready for Jindrich at: https://github.com/containers/podman-py/releases/tag/v4.0.1

Comment 10 Alex Jia 2022-10-13 13:20:53 UTC
This bug has been verified on python3-podman-4.0.1-1.module+el8.6.0+16837+85b82211.


[root@ibm-x3250m6-06 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.6 (Ootpa)

[root@ibm-x3250m6-06 ~]# rpm -q python3-podman podman runc systemd kernel
python3-podman-4.0.1-1.module+el8.6.0+16837+85b82211.noarch
podman-4.1.1-7.module+el8.6.0+16889+9f154fa9.x86_64
runc-1.1.3-2.module+el8.6.0+16771+28dfca77.x86_64
systemd-239-58.el8_6.8.x86_64
kernel-4.18.0-372.32.1.el8_6.x86_64

[test@ibm-x3250m6-06 ~]$ podman system service -t 0 &
[1] 71801
[test@ibm-x3250m6-06 ~]$ netstat -lanp|grep podman.sock
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
unix  2      [ ACC ]     STREAM     LISTENING     233550   71813/podman         /run/user/1000/podman/podman.sock
unix  2      [ ACC ]     STREAM     LISTENING     221788   -                    /run/podman/podman.sock
[test@ibm-x3250m6-06 ~]$ cat tester.py 
"""Demonstrate PodmanClient."""
import json
from podman import PodmanClient

alpine_image = "quay.io/libpod/alpine:latest"
uri = "unix:///run/user/1000/podman/podman.sock"

def test_container_healtchecks():
    """Test passing various healthcheck options"""
    with PodmanClient(base_url=uri) as client:

        containers = []
        parameters = {}

        version = client.version()
        print("Release: ", version["Version"])
        print("Compatible API: ", version["ApiVersion"])
        print("Podman API: ", version["Components"][0]["Details"]["APIVersion"], "\n")

        parameters['healthcheck'] = {'Test': ['CMD-SHELL curl http://localhost || exit']}
        parameters['health_check_on_failure_action'] = 1
        container = client.containers.create(alpine_image, **parameters)
        print("current container:%s" % container)
        containers.append(container)


if __name__ == "__main__":
    test_container_healtchecks()

[test@ibm-x3250m6-06 ~]$ python3 tester.py 
Release:  4.1.1
Compatible API:  1.40
Podman API:  4.1.1 

current container:<Container: 766bb3d2d3>

[test@ibm-x3250m6-06 ~]$ podman ps -a
CONTAINER ID  IMAGE                         COMMAND     CREATED        STATUS      PORTS       NAMES
766bb3d2d3d1  quay.io/libpod/alpine:latest  /bin/sh     3 seconds ago  Created                 sleepy_pare

Comment 14 errata-xmlrpc 2022-10-25 09:33:30 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 (container-tools:rhel8 bug fix and enhancement update), 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-2022:7127


Note You need to log in before you can comment on or make changes to this bug.