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:
1 parent
53e145bea7
commit
b4c00050e0
1 file changed
+23
-23
@@ -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,27 +515,24 @@ wait_for_status() {
|
|||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
dns_args() {
|
dns_args() {
|
||||||
if [ "$1" = "--with-dns" ] ; then
|
if [ \( "$DOCKER_VERSION_MAJOR" -lt 1 \) -o \
|
||||||
shift 1
|
\( "$DOCKER_VERSION_MAJOR" -eq 1 -a \
|
||||||
if [ \( "$DOCKER_VERSION_MAJOR" -lt 1 \) -o \
|
"$DOCKER_VERSION_MINOR" -lt 2 \) ] ; then
|
||||||
\( "$DOCKER_VERSION_MAJOR" -eq 1 -a \
|
echo "ERROR: The '--with-dns' option requires Docker 1.2.0 or later; you are running $DOCKER_VERSION" >&2
|
||||||
"$DOCKER_VERSION_MINOR" -lt 2 \) ] ; then
|
exit 1
|
||||||
echo "ERROR: The '--with-dns' option requires Docker 1.2.0 or later; you are running $DOCKER_VERSION" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
docker_bridge_ip
|
|
||||||
DNS_ARG="--dns $DOCKER_BRIDGE_IP"
|
|
||||||
DNS_SEARCH_ARG="--dns-search=."
|
|
||||||
for arg; do
|
|
||||||
case $arg in
|
|
||||||
--dns-search=*)
|
|
||||||
DNS_SEARCH_ARG=""
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac;
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
docker_bridge_ip
|
||||||
|
DNS_ARG="--dns $DOCKER_BRIDGE_IP"
|
||||||
|
DNS_SEARCH_ARG="--dns-search=."
|
||||||
|
for arg; do
|
||||||
|
case $arg in
|
||||||
|
--dns-search=*)
|
||||||
|
DNS_SEARCH_ARG=""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac;
|
||||||
|
done
|
||||||
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)
|
||||||
|
|||||||
Reference in new issue
Block a user