simplify dns-args

it makes more sense to strip off the `--with-dns` at the call site.
`weave dns-args` now does something useful, instead of having to be
invoked as `weave dns-args --with-dns`.
This commit is contained in:
Matthias Radestock committed 2015-04-20 11:31:12 +01:00
1 parent 53e145bea7
commit b4c00050e0
1 file changed
+6 -6
+6 -6
View File
@@ -103,8 +103,8 @@ if [ "$1" = "run" ]; then
shift 1 shift 1
check_docker_version check_docker_version
if [ "$1" = "--with-dns" ]; then if [ "$1" = "--with-dns" ]; then
DNS_ARGS=$(exec_remote dns-args "$@")
shift 1 shift 1
DNS_ARGS=$(exec_remote dns-args)
fi fi
collect_cidr_args "$@" collect_cidr_args "$@"
shift $CIDR_COUNT shift $CIDR_COUNT
@@ -515,8 +515,6 @@ wait_for_status() {
###################################################################### ######################################################################
dns_args() { dns_args() {
if [ "$1" = "--with-dns" ] ; then
shift 1
if [ \( "$DOCKER_VERSION_MAJOR" -lt 1 \) -o \ if [ \( "$DOCKER_VERSION_MAJOR" -lt 1 \) -o \
\( "$DOCKER_VERSION_MAJOR" -eq 1 -a \ \( "$DOCKER_VERSION_MAJOR" -eq 1 -a \
"$DOCKER_VERSION_MINOR" -lt 2 \) ] ; then "$DOCKER_VERSION_MINOR" -lt 2 \) ] ; then
@@ -535,7 +533,6 @@ dns_args() {
;; ;;
esac; esac;
done done
fi
DNS_ARGS="$DNS_ARG $DNS_SEARCH_ARG" DNS_ARGS="$DNS_ARG $DNS_SEARCH_ARG"
} }
@@ -759,7 +756,10 @@ case "$COMMAND" in
;; ;;
run) run)
[ $# -gt 0 ] || usage [ $# -gt 0 ] || usage
dns_args "$@" if [ "$1" = "--with-dns" ] ; then
shift 1
dns_args
fi
collect_cidr_args "$@" collect_cidr_args "$@"
shift $CIDR_COUNT shift $CIDR_COUNT
CONTAINER=$(docker run $DNS_ARGS -d "$@") CONTAINER=$(docker run $DNS_ARGS -d "$@")
@@ -769,7 +769,7 @@ case "$COMMAND" in
echo $CONTAINER echo $CONTAINER
;; ;;
dns-args) dns-args)
dns_args "$@" dns_args
echo -n $DNS_ARGS echo -n $DNS_ARGS
;; ;;
start) start)