Skip to content

Commit

Permalink
Call reload on list members after containers.list
Browse files Browse the repository at this point in the history
After calling containers.list each container does not have the status
correctly fetched. It will now return a list of reloaded container

client = PodmanClient()
clist = client.containers.list() # reloads every container now
clist[0].status

Fixes: containers#446

Signed-off-by: Nicola Sella <[email protected]>
  • Loading branch information
inknos committed Oct 17, 2024
1 parent 5d986e6 commit 2c6806b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion podman/domain/containers_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def list(self, **kwargs) -> List[Container]:
response = self.client.get("/containers/json", params=params)
response.raise_for_status()

return [self.prepare_model(attrs=i) for i in response.json()]
container_list = [self.prepare_model(attrs=i) for i in response.json()]
for c in container_list:
c.reload()
return container_list

def prune(self, filters: Mapping[str, str] = None) -> Dict[str, Any]:
"""Delete stopped containers.
Expand Down

0 comments on commit 2c6806b

Please sign in to comment.