containers / podman-py

Python bindings for Podman's RESTful API
Apache License 2.0
252 stars 94 forks source link

Fix dns_option typo #386

Closed robbmanes closed 7 months ago

robbmanes commented 7 months ago

The Podman API clarifies the field to give is dns_option, not dns_options here, so we need to drop the s to allow dns_opt fields to properly populate.

I thought about writing more unit tests for containers_create.py but there weren't existing tests for any of the options yet, so we'll have to add them for each API option I'd think.

Test program:

import json
from podman import PodmanClient

uri='unix:///run/user/1000/podman/podman.sock'

with PodmanClient(base_url=uri) as client:
    container = client.containers.create(
        image='registry.access.redhat.com/ubi8',
        command=['sleep 500'],
        dns_opt=['edns0'],
    )

Now properly works since we're passing in the right name:

$ podman --remote --url=unix://run/user/1000/podman/podman.sock ps -a
CONTAINER ID  IMAGE                                   COMMAND     CREATED        STATUS      PORTS       NAMES
211024bb2e5b  registry.access.redhat.com/ubi8:latest  sleep 500   5 seconds ago  Created                 silly_merkle

$ podman inspect silly_merkle | jq '.[].HostConfig.DnsOptions'
[
  "edns0"
]

Note that it looks like tox is failing for unrelated reasons; I'm hoping the CI will have different results and it's just a local problem.

mheon commented 7 months ago

@jwhonce @umohnani8 PTAL

umohnani8 commented 7 months ago

LGTM

jwhonce commented 7 months ago

/lgtm

umohnani8 commented 7 months ago

/approve

openshift-ci[bot] commented 7 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robbmanes, umohnani8

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/containers/podman-py/blob/main/OWNERS)~~ [umohnani8] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment