Skip to content

Commit

Permalink
Small workaround for container syncing
Browse files Browse the repository at this point in the history
In cases, like we currently have, where the container host is podman<5.0
and local podman/podman-py is >=5.0 we run into a TypeError. To solve
this, we resort to manually getting the status.
  • Loading branch information
JacobCallahan committed Oct 14, 2024
1 parent c37ea1c commit b8f46f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions broker/providers/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@

def container_info(container_inst):
"""Return a dict of container information."""
return {
info = {
"_broker_provider": "Container",
"name": container_inst.name,
"hostname": container_inst.id[:12],
"image": container_inst.image.tags,
"ports": container_inst.ports,
"status": container_inst.status,
}
try:
info["status"] = container_inst.status
except TypeError:
info["status"] = container_inst.attrs["State"]
return info


def _host_release():
Expand Down

0 comments on commit b8f46f1

Please sign in to comment.