Open
Description
When trying to get the status of a container instance running on a remote podman host, I get the following error.
Out[5]: <Container: 859c3172e0>
In [6]: container_inst.id
Out[6]: '859c3172e0de5e27934ba7bcbd190d0949227bfe973ded77658d25f30a1585c2'
In [7]: container_inst.status
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[7], line 1
----> 1 container_inst.status
File ~/Programming/broker/.venv/lib64/python3.12/site-packages/podman/domain/containers.py:54, in Container.status(self)
52 """Literal["running", "stopped", "exited", "unknown"]: Returns status of container."""
53 with suppress(KeyError):
---> 54 return self.attrs["State"]["Status"]
55 return "unknown"
TypeError: string indices must be integers, not 'str'
When checking the value of attrs for the instance, I see that status isn't nested under state.
In [1]: self.attrs
Out[1]:
{'AutoRemove': False,
'Command': ['/bin/sh', '-c', '/tmp/startup.sh'],
...
'StartedAt': 1728929152,
'State': 'running',
'Status': ''}
There is also a possibility that this is due to a difference in major podman versions.
Local Podman: podman-5.2.3-1.fc40.x86_64
Local podman-py: 5.0.0
Remote Podman: podman-4.9.4-4