Skip to content

fix: handle string State payload in Container.status - #671

Open
reginaldalfret wants to merge 1 commit into
containers:mainfrom
reginaldalfret:fix/issue-662-container-status
Open

reginaldalfret wants to merge 1 commit into
containers:mainfrom
reginaldalfret:fix/issue-662-container-status

Conversation

@reginaldalfret

Copy link
Copy Markdown

Summary

Containers returned by containers.list() carry the list payload where State is represented as a string (such as "created" or "running") rather than an inspect dictionary. In that case, accessing Container.status raised a TypeError when indexing the string.

This PR updates Container.status to handle both string and dict representations of State, returning "unknown" if missing, and adds unit tests covering both inspect and list payloads.

Fixes #662

Signed-off-by: reginaldalfret reginaldalfret@gmail.com

Containers returned by containers.list() contain a string State attribute rather than a dictionary. Support string State in Container.status property so it does not raise TypeError.

Fixes containers#662

Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>

This branch was successfully deployed

1 active deployment
build — 81490bae Deployed Oct 6, 2026 by reginaldalfret via Test Build Python distribution 📦 #266
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

Successfully merging this pull request may close these issues.

Container.status raises TypeError on containers returned by containers.list()

1 participant