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

[BUG] containers_create keyword arg "environment" fails json parse for List[str] #489

Open
jgperin opened this issue Dec 20, 2024 · 0 comments · May be fixed by #513
Open

[BUG] containers_create keyword arg "environment" fails json parse for List[str] #489

jgperin opened this issue Dec 20, 2024 · 0 comments · May be fixed by #513
Labels
bug Something isn't working

Comments

@jgperin
Copy link

jgperin commented Dec 20, 2024

https://github.com/containers/podman-py/blob/main/podman/domain/containers_create.py

environment (Union[Dict[str, str], List[str]): Environment variables to set inside
                the container, as a dictionary or a List[str] in the format
                ["SOMEVARIABLE=xxx", "SOMEOTHERVARIABLE=xyz"].

...

 # Transform keywords into parameters
        params = {
             ...
             "env": pop("environment"),
        }

This fails like so

podman.errors.exceptions.APIError: 500 Server Error: Internal Server Error (decode(): json: cannot unmarshal array into Go struct field SpecGenerator.env of type map[string]string)

https://docs.podman.io/en/latest/_static/api.html#tag/containers/operation/ContainerCreateLibpod

object
Env is a set of environment variables that will be set in the container. Optional.

This will fail to parse unless passed as an object.

@inknos inknos added the bug Something isn't working label Jan 21, 2025
@Mr-Sunglasses Mr-Sunglasses linked a pull request Feb 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants