Fix another upgrade from docker-py to docker place

This patch fix the error from nova, when using nova-docker driver:
CRITICAL nova Unhandled error: AttributeError: 'module' object has no attribute 'Client'

Change-Id: Ie9b2655b2353a40e504ac2e4bd3c59f829d42a39
Partial-Implements: blueprint adopt-docker-py-2.0-api
This commit is contained in:
zhurong 2017-07-11 12:05:40 +08:00
parent 2f3629a91d
commit 8f2ff32438

View File

@ -20,8 +20,7 @@ import inspect
from oslo_config import cfg
import six
from docker import client
from docker import tls
import docker
CONF = cfg.CONF
DEFAULT_TIMEOUT_SECONDS = 120
@ -52,7 +51,7 @@ def filter_data(f):
return wrapper
class DockerHTTPClient(client.Client):
class DockerHTTPClient(docker.APIClient):
def __init__(self, url='unix://var/run/docker.sock'):
if (CONF.docker.cert_file or
CONF.docker.key_file):
@ -62,7 +61,7 @@ class DockerHTTPClient(client.Client):
if (CONF.docker.ca_file or
CONF.docker.api_insecure or
client_cert):
ssl_config = tls.TLSConfig(
ssl_config = docker.tls.TLSConfig(
client_cert=client_cert,
ca_cert=CONF.docker.ca_file,
verify=CONF.docker.api_insecure)