summaryrefslogtreecommitdiffstats
path: root/mcp/scripts/lib.sh
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-08-31 18:31:09 +0200
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-08-31 18:47:36 +0200
commit1854f7ab732c79db446f9b240e95533a1e6698ca (patch)
treef55ce0647b3d75606597b5fb969e9819989fb15e /mcp/scripts/lib.sh
parent8bb79e6beb10738d2756d8b33950452bcc44f493 (diff)
[docker] Use distro docker-compose if not broken
While at it, use explicit `docker-compose pull` call to maintain backwards compatibility with older docker-compose (1.8.0 on aarch64). JIRA: FUEL-383 Change-Id: I0f6ac4fb59c0a286ac99a1a0dc4484d00f3837fe Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp/scripts/lib.sh')
-rw-r--r--mcp/scripts/lib.sh23
1 files changed, 14 insertions, 9 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 8f7cccd26..1455d940c 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -490,8 +490,9 @@ function prepare_containers {
local image_dir=$1
[ -n "${image_dir}" ] || exit 1
[ -n "${MCP_REPO_ROOT_PATH}" ] || exit 1
+ docker-compose --version > /dev/null 2>&1 || COMPOSE_PREFIX="${image_dir}/"
- "${image_dir}/docker-compose" -f docker-compose/docker-compose.yaml down
+ "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml down
sudo rm -rf "${image_dir}/salt" "${image_dir}/nodes/"*
mkdir -p "${image_dir}/salt/"{master.d,minion.d}
# salt state does not properly configure file_roots in master.conf, hard set it
@@ -506,7 +507,9 @@ function prepare_containers {
function start_containers {
local image_dir=$1
[ -n "${image_dir}" ] || exit 1
- "${image_dir}/docker-compose" -f docker-compose/docker-compose.yaml up --quiet-pull -d
+ docker-compose --version > /dev/null 2>&1 || COMPOSE_PREFIX="${image_dir}/"
+ "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml pull
+ "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml up -d
}
function check_connection {
@@ -619,12 +622,14 @@ function docker_install {
fi
fi
# Distro-provided docker-compose might be simply broken (Ubuntu 16.04, CentOS 7)
- COMPOSE_BIN="${image_dir}/docker-compose"
- COMPOSE_VERSION='1.22.0'
- notify_n "[WARN] Using docker-compose ${COMPOSE_VERSION} in ${COMPOSE_BIN}" 3
- if [ ! -e "${COMPOSE_BIN}" ]; then
- COMPOSE_URL="https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}"
- sudo curl -L "${COMPOSE_URL}/docker-compose-$(uname -s)-$(uname -m)" -o "${COMPOSE_BIN}"
- sudo chmod +x "${COMPOSE_BIN}"
+ if ! docker-compose --version > /dev/null 2>&1; then
+ COMPOSE_BIN="${image_dir}/docker-compose"
+ COMPOSE_VERSION='1.22.0'
+ notify_n "[WARN] Using docker-compose ${COMPOSE_VERSION} in ${COMPOSE_BIN}" 3
+ if [ ! -e "${COMPOSE_BIN}" ]; then
+ COMPOSE_URL="https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}"
+ sudo curl -L "${COMPOSE_URL}/docker-compose-$(uname -s)-$(uname -m)" -o "${COMPOSE_BIN}"
+ sudo chmod +x "${COMPOSE_BIN}"
+ fi
fi
}