Commit 4fda2dc7 authored by Julien Muchembled's avatar Julien Muchembled

Fix wrong WARNING when own ip is unknown at startup

parent d7a4d73f
......@@ -203,12 +203,15 @@ class Cache(object):
def my_address(self):
for x, in self._db.execute("SELECT address FROM peer WHERE NOT prefix"):
return x
return ''
@my_address.setter
def my_address(self, *args):
with self._db as db:
db.execute("INSERT OR REPLACE INTO peer VALUES ('', ?)", args)
def my_address(self, value):
if value:
with self._db as db:
db.execute("INSERT OR REPLACE INTO peer VALUES ('', ?)",
(value,))
else:
del self.my_address
@my_address.deleter
def my_address(self):
......
......@@ -213,12 +213,14 @@ class BaseTunnelManager(object):
if any(address_dict.itervalues()):
del cache.my_address
else:
for address in utils.parse_address(cache.my_address):
try:
proto = proto_dict[address[2]]
except KeyError:
continue
address_dict[proto[0]].append(address)
address = cache.my_address
if address:
for address in utils.parse_address(address):
try:
proto = proto_dict[address[2]]
except KeyError:
continue
address_dict[proto[0]].append(address)
db = os.getenv('GEOIP2_MMDB')
if db:
from geoip2 import database, errors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment