Support '--subnet default'
This commit is contained in:
1 parent
3a9af4413d
commit
2b4eec39cf
2 files changed
+12
-2
No files matched your search
@@ -18,7 +18,7 @@ start_container $HOST2 $C2/24 --name=c2
|
||||
assert_raises "exec_on $HOST1 c1 $PING $C2"
|
||||
|
||||
start_container $HOST1 --name=c3
|
||||
start_container $HOST2 --name=c4
|
||||
start_container $HOST2 --subnet default --name=c4
|
||||
C4=$(container_ip $HOST2 c4)
|
||||
assert_raises "exec_on $HOST1 c3 $PING $C4"
|
||||
|
||||
|
||||
@@ -108,6 +108,12 @@ collect_cidr_args() {
|
||||
while is_cidr "$1" || [ "$1" = "--subnet" ] ; do
|
||||
CIDR_ARGS="$CIDR_ARGS $1"
|
||||
CIDR_COUNT=$((CIDR_COUNT + 1))
|
||||
# only accept 'default' after '--subnet', in case someone has a container called 'default'
|
||||
if [ "$1" = "--subnet" -a "$2" = "default" ] ; then
|
||||
CIDR_ARGS="$CIDR_ARGS $2"
|
||||
CIDR_COUNT=$((CIDR_ARG_COUNT + 1))
|
||||
shift 1
|
||||
fi
|
||||
shift 1
|
||||
done
|
||||
}
|
||||
@@ -762,7 +768,11 @@ ipam_cidrs() {
|
||||
while [ $# -gt 0 ] ; do
|
||||
if [ $# -gt 1 -a "$1" = "--subnet" ] ; then
|
||||
shift 1
|
||||
CIDR=$(http_call $CONTAINER_NAME $HTTP_PORT POST /ip/$CONTAINER_ID/$1)
|
||||
if [ "$1" = "default" ] ; then
|
||||
CIDR=$(http_call $CONTAINER_NAME $HTTP_PORT POST /ip/$CONTAINER_ID)
|
||||
else
|
||||
CIDR=$(http_call $CONTAINER_NAME $HTTP_PORT POST /ip/$CONTAINER_ID/$1)
|
||||
fi
|
||||
if [ "$CIDR" = "404 page not found" ] ; then
|
||||
echo "IP address allocation must be enabled to use --subnet (use the -iprange option on 'weave launch')" >&2
|
||||
return 1
|
||||
|
||||
Reference in new issue
Block a user