Skip to content

Commit

Permalink
Merge pull request #936 from TrimBiggs/ip6-match
Browse files Browse the repository at this point in the history
Add better IPv6 addr match check when starting node
  • Loading branch information
TrimBiggs committed Apr 22, 2016
2 parents 1515285 + e102cfc commit 70546fe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
29 changes: 22 additions & 7 deletions calico_node/filesystem/startup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2016 Metaswitch Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import sys

Expand Down Expand Up @@ -171,13 +185,14 @@ def warn_if_unknown_ip(ip, ip6):
:param ip6: IPv6 address which should be present on the host.
:return: None
"""
if ip and ip not in get_host_ips(version=4, exclude=["docker0"]):
print "WARNING: Could not confirm that the provided IPv4 address is assigned" \
" to this host."

if ip6 and ip6 not in get_host_ips(version=6, exclude=["docker0"]):
print "WARNING: Could not confirm that the provided IPv6 address is assigned" \
" to this host."
if ip and IPAddress(ip) not in get_host_ips(version=4, exclude=["docker0"]):
print "WARNING: Could not confirm that the provided IPv4 address is" \
" assigned to this host."

if ip6 and IPAddress(ip6) not in get_host_ips(version=6,
exclude=["docker0"]):
print "WARNING: Could not confirm that the provided IPv6 address is" \
" assigned to this host."


def warn_if_hostname_conflict(ip):
Expand Down
2 changes: 1 addition & 1 deletion calico_test/tests/st/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_ip(v6=False):
version = 6 if v6 else 4
ips = get_host_ips(version)
if ips:
ip = ips[0]
ip = str(ips[0])

return ip

Expand Down

0 comments on commit 70546fe

Please sign in to comment.