Skip to content

Commit

Permalink
Overhaul instantiating docker API class (#57)
Browse files Browse the repository at this point in the history
* Overhaul instantiating docker API class

Don't pin docker APIClient to version 1.22.

Don't try to instantiate docker.Client before trying docker.APIClient:
the former dates from the days the library was called "docker-py", the
last release for which was November 2016. EPEL 7 and onwards provide
the newer Python docker library, so I doubt there's anyone left using
the older one.

This now aligns with Cekit.

Signed-off-by: Jonathan Dowland <[email protected]>

* Request a specific docker API version to match Cekit

Signed-off-by: Jonathan Dowland <[email protected]>

---------

Signed-off-by: Jonathan Dowland <[email protected]>
  • Loading branch information
jmtd authored Mar 14, 2024
1 parent ec64091 commit 9eb05de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions steps/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import time
import multiprocessing as mp

try:
d = docker.Client(version="1.22")
except:
d = docker.APIClient(version="1.22")
# A future version of Cekit will expose this to us, for now we hard-code
DOCKER_API_VERSION = "1.35"

d = docker.APIClient(version=DOCKER_API_VERSION)


class ExecException(Exception):
Expand Down
8 changes: 3 additions & 5 deletions steps/image_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

from behave import then

# A future version of Cekit will expose this to us, for now we hard-code
DOCKER_API_VERSION = "1.35"

try:
DOCKER_CLIENT = docker.Client(version="1.22")
except:
DOCKER_CLIENT = docker.APIClient(version="1.22")

DOCKER_CLIENT = docker.APIClient(version=DOCKER_API_VERSION)

@then(u'the image should contain label {label}')
@then(u'the image should contain label {label} {check} value {value}')
Expand Down

0 comments on commit 9eb05de

Please sign in to comment.