small simplifying refactor: use shortcircuit boolean expressions

This commit is contained in:
Matthias Radestock committed 2015-07-04 18:04:25 +01:00
1 parent cf4fffa394
commit 156597a965
1 file changed
+2 -6
+2 -6
View File
@@ -833,9 +833,7 @@ ipam_cidrs() {
IPAM_CIDRs=""
if [ $# -eq 0 ] ; then
# If no addresses passed in, get one in the default subnet
if ! IPAM_CIDRS=$(call_weave POST /ip/$CONTAINER_ID) ; then
return 1
fi
IPAM_CIDRS=$(call_weave POST /ip/$CONTAINER_ID) || return 1
if [ "$IPAM_CIDRS" = "404 page not found" ] ; then
echo "No IP address supplied (use the -iprange option on 'weave launch' to enable IP address allocation)" >&2
return 1
@@ -849,9 +847,7 @@ ipam_cidrs() {
else
IPAM_URL=/ip/$CONTAINER_ID/"${1#net:}"
fi
if ! CIDR=$(call_weave POST $IPAM_URL) ; then
return 1
fi
CIDR=$(call_weave POST $IPAM_URL) || return 1
if [ "$CIDR" = "404 page not found" ] ; then
echo "IP address allocation must be enabled to use 'net:'" >&2
return 1