Do not attempt to re-install docker, regardless of its running status

Commit c96032ecc1 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
This commit is contained in:
Salvatore Orlando 2016-05-23 16:42:05 -07:00
parent 5799770c7b
commit d32f09ffb6
1 changed files with 16 additions and 4 deletions

View File

@ -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