diff --git a/weave b/weave index b2da6ed8..fe071c42 100755 --- a/weave +++ b/weave @@ -951,23 +951,14 @@ stop() { } # Given a container name or short ID in $1, ensure the specified -# container is running and then print its full ID to stdout. If -# it's not running or doesn't exist, print an error to stderr and +# container exists and then print its full ID to stdout. If +# it doesn't exist, print an error to stderr and # return with an indicative non-zero exit code. container_id() { - if ! status=$(docker inspect --format='{{.State.Running}} {{.Id}}' $1 2>/dev/null) ; then + if ! docker inspect --format='{{.Id}}' $1 2>/dev/null ; then echo "Error: No such container: $1" >&2 return 1 fi - case "$status" in - true*) - echo "${status#true }" - ;; - *) - echo "$1 container is not running." >&2 - return 2 - ;; - esac } container_ip() { @@ -1033,7 +1024,7 @@ wait_for_status() { shift while true ; do "$@" GET /status >/dev/null 2>&1 && return 0 - if ! container_id $container >/dev/null 2>&1 ; then + if ! check_running $container >/dev/null 2>&1 ; then echo $(death_msg $container) >&2 return 1 fi @@ -1286,6 +1277,7 @@ collect_dns_add_remove_args() { [ $# -eq 0 -a \( -n "$C" -o \( $IP_COUNT -gt 0 -a -n "$FQDN" \) \) ] || usage check_running $CONTAINER_NAME if [ -n "$C" ] ; then + check_running $C CONTAINER=$(container_id $C) [ $IP_COUNT -gt 0 ] || IP_ARGS=$(with_container_addresses echo_ips $CONTAINER) fi