From d32f09ffb653da1651541162debaaa0d3887bce4 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Mon, 23 May 2016 16:42:05 -0700 Subject: [PATCH] Do not attempt to re-install docker, regardless of its running status Commit c96032ecc11b44b53f60c6240ffb05439fe57a91 changed the devstack plugin to avoid reinstalling docker if the service was running. However, there are a few meaningful cases where the service is not running but the package is however installed and the user does not want devstack to reinstall it. This patch uses the distro package manager to find whether docker-engine is insstalled already, rather than systemd or init.d. The docker installation script will take care of cases where docker was manually installed from binaries. Change-Id: I6f66fdd3c35739486a6453b484eab81dfb4a9545 --- devstack/plugin.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 9f3d5cbb..33cbdf67 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -30,6 +30,16 @@ function install_etcd_data_store { rm -rf $DEST/etcd/db.etcd } + +function check_docker { + if is_ubuntu; then + dpkg -s docker-engine > /dev/null 2>&1 + else + rpm -q docker-engine > /dev/null 2>&1 + fi +} + + # main loop if is_service_enabled kuryr; then if [[ "$1" == "stack" && "$2" == "install" ]]; then @@ -86,10 +96,12 @@ if is_service_enabled kuryr; then # docker and specifically Kuryr. So, this works around that. sudo update-alternatives --install /bin/sh sh /bin/bash 100 - # Install docker only if it does not exist in the system - # We don't use `command -v docker` because other packages with binary - # called `docker` can be installed in the system - service docker status >/dev/null 2>&1 || { + # Install docker only if it's not already installed. The following checks + # whether the docker-engine package is already installed, as this is the + # most common way for installing docker from binaries. In case it's been + # manually installed, the install_docker.sh script will prompt a warning + # if another docker executable is found + check_docker || { wget http://get.docker.com -O install_docker.sh sudo chmod 777 install_docker.sh sudo sh install_docker.sh