Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when getting metadata with podman #388

Open
abompard opened this issue Jan 25, 2022 · 0 comments
Open

Crash when getting metadata with podman #388

abompard opened this issue Jan 25, 2022 · 0 comments

Comments

@abompard
Copy link

The format that podman inspect returns does not seem to fit the format that conu expects when getting the metadata. I'm trying to use container.is_port_open() but it fails with a TypeError. Here is a simple script to reproduce it:

import logging
from conu import PodmanBackend

with PodmanBackend(logging_level=logging.DEBUG) as backend:
    image = backend.ImageClass("quay.io/bodhi-ci/postgresql", tag="latest")
    container = image.run_via_binary()
    print(container.get_metadata())

This is the output:

$ python reproduce.py
16:11:38.682 backend.py        INFO   conu has initiated, welcome to the party!
16:11:38.682 backend.py        DEBUG  conu version: 1.0.0
16:11:38.682 __init__.py       DEBUG  command: "podman version"
16:11:38.854 __init__.py       DEBUG  Version:      3.4.2
API Version:  3.4.2
Go Version:   go1.16.8
Built:        Sun Nov 14 01:16:48 2021
OS/Arch:      linux/amd64

16:11:38.855 __init__.py       DEBUG  command: "podman inspect quay.io/bodhi-ci/postgresql:latest"
16:11:39.032 image.py          INFO   run container via binary in background
16:11:39.033 image.py          DEBUG  podman command: ['podman', 'run', '-d', '--cidfile=/tmp/conu-3jbb77jo/conu-ljnwtyullmmweosczkxefgteasiwtglx', '--label', 'conu.test_artifact=1', 'f51c55ac75ed8f2c2ba5fe44b7d065f3bdbc501fa7a798dc303aa293d2089a6c']
16:11:39.034 __init__.py       DEBUG  command: "podman run -d --cidfile=/tmp/conu-3jbb77jo/conu-ljnwtyullmmweosczkxefgteasiwtglx --label conu.test_artifact=1 f51c55ac75ed8f2c2ba5fe44b7d065f3bdbc501fa7a798dc303aa293d2089a6c"
16:11:39.314 __init__.py       DEBUG  03c7321efe07d71eb22c96b6c04b6638ef6c8aa97ffdd062fcc319d6bcbcf96d

16:11:39.316 probes.py         DEBUG  starting probe
16:11:39.318 probes.py         DEBUG  first process started: pid=2018362
16:11:39.319 probes.py         DEBUG  pausing for 0.2 before next try
16:11:39.319 probes.py         DEBUG  Running "<lambda>" with parameters: "{}":	0/10
16:11:39.320 probes.py         DEBUG  callback result = True
16:11:39.520 probes.py         DEBUG  waiting for process to end...
16:11:39.521 probes.py         DEBUG  result = True
16:11:39.522 __init__.py       DEBUG  command: "podman inspect 03c7321efe07d71eb22c96b6c04b6638ef6c8aa97ffdd062fcc319d6bcbcf96d"
16:11:39.723 __init__.py       DEBUG  command: "podman container inspect 03c7321efe07d71eb22c96b6c04b6638ef6c8aa97ffdd062fcc319d6bcbcf96d"
Traceback (most recent call last):
  File "/home/abompard/Fedora/contrib/conu/reproduce.py", line 7, in <module>
    print(container.get_metadata())
  File "/home/abompard/Fedora/contrib/conu/conu/backend/podman/container.py", line 341, in get_metadata
    inspect_to_container_metadata(self._metadata, self.inspect(refresh=True), self.image)
  File "/home/abompard/Fedora/contrib/conu/conu/backend/podman/utils.py", line 83, in inspect_to_container_metadata
    inspect_to_metadata(c_metadata_object, inspect_data)
  File "/home/abompard/Fedora/contrib/conu/conu/backend/podman/utils.py", line 51, in inspect_to_metadata
    metadata_object.exposed_ports = list(set([d["containerPort"] for d in raw_exposed_ports]))
  File "/home/abompard/Fedora/contrib/conu/conu/backend/podman/utils.py", line 51, in <listcomp>
    metadata_object.exposed_ports = list(set([d["containerPort"] for d in raw_exposed_ports]))
TypeError: string indices must be integers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant