Skip to content
Snippets Groups Projects
Commit 4b0f68b9216b authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

make dev script compatible with newer python-docker as in 8b89c9943c1f

parent d52e700bc720
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
import ConfigParser import ConfigParser
import docker # apt python-docker (1.9) import docker # apt python-docker (1.9) or pip install docker
from psycopg2 import connect, OperationalError # apt python-psycopg2 from psycopg2 import connect, OperationalError # apt python-psycopg2
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
from psycopg2 import connect, OperationalError # apt python-psycopg2 from psycopg2 import connect, OperationalError # apt python-psycopg2
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
if docker.__version__ > '3.0.0':
from docker import APIClient as docker_api
else:
from docker import Client as docker_api
# TODO auto create list of module # TODO auto create list of module
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
...@@ -241,7 +246,7 @@ ...@@ -241,7 +246,7 @@
c.get('odoo_scripts', 'postgresql_version')) or '9.6' c.get('odoo_scripts', 'postgresql_version')) or '9.6'
logging.debug("Docker image: %s", image) logging.debug("Docker image: %s", image)
# detect if docker image already exists # detect if docker image already exists
docker_client = docker.Client(base_url='unix://var/run/docker.sock') docker_client = docker_api(base_url='unix://var/run/docker.sock')
image_list = docker_client.images(name=image, quiet=True) image_list = docker_client.images(name=image, quiet=True)
if not image_list: if not image_list:
logging.warn("Image %s does not exist", image) logging.warn("Image %s does not exist", image)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment