Commit febaab8c authored by Xavier Thompson's avatar Xavier Thompson

slapformat: Refactor IPv6 existence check

parent a9f102f7
...@@ -1006,6 +1006,8 @@ class Interface(object): ...@@ -1006,6 +1006,8 @@ class Interface(object):
except KeyError: except KeyError:
raise ValueError("%s must have at least one IPv6 address assigned" % raise ValueError("%s must have at least one IPv6 address assigned" %
interface_name) interface_name)
if not address_list:
raise NoAddressOnInterface(interface_name)
if tap: if tap:
try: try:
...@@ -1152,9 +1154,6 @@ class Interface(object): ...@@ -1152,9 +1154,6 @@ class Interface(object):
# Getting one address of the interface as base of the next addresses # Getting one address of the interface as base of the next addresses
interface_addr_list = self.getGlobalScopeAddressList() interface_addr_list = self.getGlobalScopeAddressList()
# No address found
if len(interface_addr_list) == 0:
raise NoAddressOnInterface(interface_name)
address_dict = interface_addr_list[0] address_dict = interface_addr_list[0]
if addr is not None: if addr is not None:
......
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