Upgrade from docker-py to docker

The pypi package 'docker-py' [1] has been renamed to 'docker' [2].
It is better to move to the new 'docker' package because the old
package will be deprecated and all the new features will go into
the new package only.

Package 'docker' has been added to requirements [3]. The old
package 'docker-py' is still allowed to be in the global requirements
during the transition period but it should be removed after all or
most of the projects finsih the migration.

[1] https://pypi.python.org/pypi/docker-py
[2] https://pypi.python.org/pypi/docker
[3] https://review.openstack.org/#/c/423715/

Change-Id: Ibcd5a57a1fbf55dcc5a690e41f20917f95b63da0
This commit is contained in:
Hongbin Lu 2017-06-20 22:21:21 +00:00
parent 4510c525a6
commit 3daeea37ea
11 changed files with 13 additions and 22 deletions

View File

@ -53,9 +53,6 @@ import docker
def get_docker_client(): def get_docker_client():
try:
return docker.Client
except AttributeError:
return docker.APIClient return docker.APIClient

View File

@ -198,9 +198,6 @@ import docker
def get_docker_client(): def get_docker_client():
try:
return docker.Client
except AttributeError:
return docker.APIClient return docker.APIClient

View File

@ -109,9 +109,6 @@ def gen_commandline(params):
def get_docker_client(): def get_docker_client():
try:
return docker.Client
except AttributeError:
return docker.APIClient return docker.APIClient

View File

@ -52,8 +52,8 @@
easy_install: name=pip easy_install: name=pip
become: True become: True
- name: Install docker-py - name: Install docker SDK for python
pip: name=docker-py state=latest pip: name=docker state=latest
become: True become: True
- name: Remove packages - name: Remove packages

View File

@ -1,5 +1,5 @@
--- ---
- name: Checking docker-py version - name: Checking docker SDK version
command: "{{ ansible_python.executable }} -c \"import docker; print docker.__version__\"" command: "{{ ansible_python.executable }} -c \"import docker; print docker.__version__\""
register: result register: result
changed_when: false changed_when: false

View File

@ -1,4 +1,4 @@
--- ---
docker_version_min: '1.10.0' docker_version_min: '1.10.0'
docker_py_version_min: '1.8.1' docker_py_version_min: '2.0.0'
ansible_version_min: '2.2.0' ansible_version_min: '2.2.0'

View File

@ -76,7 +76,7 @@ function prep_work {
exit 1 exit 1
fi fi
pip install --upgrade docker-py pip install --upgrade docker
} }
# Do some cleanup after the installation of kolla # Do some cleanup after the installation of kolla

View File

@ -105,7 +105,7 @@ Component Min Version Max Version Comment
===================== =========== =========== ========================= ===================== =========== =========== =========================
Ansible 2.2.0 none On deployment host Ansible 2.2.0 none On deployment host
Docker 1.10.0 none On target nodes Docker 1.10.0 none On target nodes
Docker Python 1.8.1 none On target nodes Docker Python 2.0.0 none On target nodes
Python Jinja2 2.8.0 none On deployment host Python Jinja2 2.8.0 none On deployment host
===================== =========== =========== ========================= ===================== =========== =========== =========================
@ -242,7 +242,7 @@ Or using ``pip`` to install the latest version:
:: ::
pip install -U docker-py pip install -U docker
OpenStack, RabbitMQ, and Ceph require all hosts to have matching times to OpenStack, RabbitMQ, and Ceph require all hosts to have matching times to

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0
docker-py>=1.8.1 # Apache-2.0 docker>=2.0.0 # Apache-2.0
Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause) Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause)
six>=1.9.0 # MIT six>=1.9.0 # MIT
oslo.config!=4.3.0,!=4.4.0,>=4.0.0 # Apache-2.0 oslo.config!=4.3.0,!=4.4.0,>=4.0.0 # Apache-2.0

View File

@ -173,7 +173,7 @@ FAKE_DATA = {
} }
@mock.patch("docker.Client") @mock.patch("docker.APIClient")
def get_DockerWorker(mod_param, mock_dclient): def get_DockerWorker(mod_param, mock_dclient):
module = mock.MagicMock() module = mock.MagicMock()
module.params = mod_param module.params = mod_param

View File

@ -118,7 +118,7 @@ function setup_ansible {
mkdir /tmp/kolla mkdir /tmp/kolla
# TODO(SamYaple): Move to virtualenv # TODO(SamYaple): Move to virtualenv
sudo -H pip install -U "ansible>=2" "docker-py>=1.6.0" "python-openstackclient" "python-neutronclient" "ara" sudo -H pip install -U "ansible>=2" "docker>=2.0.0" "python-openstackclient" "python-neutronclient" "ara"
detect_distro detect_distro
setup_inventory setup_inventory