From ac29fba7bc73a079bbdff578a359d48d5b2fd648 Mon Sep 17 00:00:00 2001 From: Peter Bourgon Date: Mon, 13 Jul 2015 13:40:46 +0200 Subject: [PATCH] Don't fail if CACHE_DIR has a missing component Also, don't invoke weave if it's not running. --- bin/rebuild-ui-build-image | 2 +- scope | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/rebuild-ui-build-image b/bin/rebuild-ui-build-image index db426cc61..1e9704304 100755 --- a/bin/rebuild-ui-build-image +++ b/bin/rebuild-ui-build-image @@ -5,7 +5,7 @@ set -eux CACHE_DIR=$HOME/docker/ rebuild() { - rm $CACHE_DIR/* + rm $CACHE_DIR/* || true make scope_ui_build.tar mkdir -p $CACHE_DIR mv scope_ui_build.tar $CACHE_DIR/image-$CIRCLE_SHA1 diff --git a/scope b/scope index ac1df4ab8..942eb8a48 100755 --- a/scope +++ b/scope @@ -152,7 +152,9 @@ case "$COMMAND" in # If Weave is running, we want to expose a Weave IP to the host # network namespace, so Scope can use it. - weave_expose + if is_running $WEAVE_CONTAINER_NAME; then + weave_expose + fi # If WeaveDNS is running, we want to automatically tell the scope # image to use weave dns. We can't use --dns with --net=host, so we @@ -168,11 +170,14 @@ case "$COMMAND" in IP_ADDRS=$(docker run --net=host gliderlabs/alpine /bin/sh -c "$IP_ADDR_CMD") if is_running $DNS_CONTAINER_NAME; then - if [ -z "$IP_ADDRS" ]; then - echo "Could not determine local IP address; Weave DNS integration will not work correctly." - exit 1 + if is_running $WEAVE_CONTAINER_NAME; then + if [ -z "$IP_ADDRS" ]; then + echo "Could not determine local IP address; Weave DNS integration will not work correctly." + exit 1 + fi + + weave_dns_add $CONTAINER $FQDN $IP_ADDRS fi - weave_dns_add $CONTAINER $FQDN $IP_ADDRS fi echo $CONTAINER