From 7a5244bf7c5b4fb486de5c69b31e772626d4c5ad Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Wed, 21 Dec 2016 23:03:24 +0100 Subject: [PATCH 1/2] Bugfixed __docker_compose: If docker-compose is already running, curl won't override the binary I add an if the file does not exist before download --- cdist/conf/type/__docker_compose/gencode-remote | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cdist/conf/type/__docker_compose/gencode-remote b/cdist/conf/type/__docker_compose/gencode-remote index f22823d3..3f2fb940 100644 --- a/cdist/conf/type/__docker_compose/gencode-remote +++ b/cdist/conf/type/__docker_compose/gencode-remote @@ -22,7 +22,6 @@ version="$(cat "$__object/parameter/version")" # Download docker-compose file -echo 'curl -L "https://github.com/docker/compose/releases/download/'${version}'/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose' - + echo 'if [ ! -e /usr/local/bin/docker-compose ]; then curl -L "https://github.com/docker/compose/releases/download/'${version}'/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose ; fi' # Change permissions echo 'chmod +x /usr/local/bin/docker-compose' From 6fa7bfbfb57dfd29dfaac333f9e172ac6d23aaf1 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Tue, 27 Dec 2016 13:20:57 +0100 Subject: [PATCH 2/2] Better bugfix: - Download the docker-compose binary first to /tmp then move it to its target location --- cdist/conf/type/__docker_compose/gencode-remote | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__docker_compose/gencode-remote b/cdist/conf/type/__docker_compose/gencode-remote index 3f2fb940..3424ed6d 100644 --- a/cdist/conf/type/__docker_compose/gencode-remote +++ b/cdist/conf/type/__docker_compose/gencode-remote @@ -22,6 +22,7 @@ version="$(cat "$__object/parameter/version")" # Download docker-compose file - echo 'if [ ! -e /usr/local/bin/docker-compose ]; then curl -L "https://github.com/docker/compose/releases/download/'${version}'/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose ; fi' + echo 'curl -L "https://github.com/docker/compose/releases/download/'${version}'/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose' + echo 'mv /tmp/docker-compose /usr/local/bin/docker-compose' # Change permissions echo 'chmod +x /usr/local/bin/docker-compose'