Merge pull request #2685 from weaveworks/issues/2480-correct-mac
Take peerName from weave bridge if not specified Fixes #2480
This commit is contained in:
commit
856cb48170
2 files changed
+7
-7
No files matched your search
@@ -22,8 +22,7 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# Need to create bridge before running weaver so we can use the peer address
|
||||
# (because of https://github.com/weaveworks/weave/issues/2480)
|
||||
# Explicitly create the bridge so we can pass --expect-npc
|
||||
WEAVE_NPC_OPTS="--expect-npc"
|
||||
if [ "${EXPECT_NPC}" = "0" ]; then
|
||||
WEAVE_NPC_OPTS=""
|
||||
@@ -69,7 +68,7 @@ fi
|
||||
--http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \
|
||||
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
||||
--ipalloc-init $IPALLOC_INIT \
|
||||
--name=$(cat /sys/class/net/weave/address) "$@" \
|
||||
"$@" \
|
||||
$KUBE_PEERS &
|
||||
WEAVE_PID=$!
|
||||
|
||||
|
||||
+5
-4
@@ -232,7 +232,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
name := peerName(routerName, bridge.Interface())
|
||||
name := peerName(routerName)
|
||||
|
||||
if nickName == "" {
|
||||
var err error
|
||||
@@ -528,10 +528,11 @@ func determinePassword(password string) []byte {
|
||||
return []byte(password)
|
||||
}
|
||||
|
||||
func peerName(routerName string, iface *net.Interface) mesh.PeerName {
|
||||
func peerName(routerName string) mesh.PeerName {
|
||||
if routerName == "" {
|
||||
if iface == nil {
|
||||
Log.Fatal("Either an interface must be specified with --datapath or --iface, or a name with --name")
|
||||
iface, err := net.InterfaceByName(weavenet.WeaveBridgeName)
|
||||
if err != nil {
|
||||
Log.Fatalf("Unable to find bridge %q", weavenet.WeaveBridgeName)
|
||||
}
|
||||
routerName = iface.HardwareAddr.String()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user