mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: dhcp: Policy to wait for IPv6 link local address to be available
Rename the policy attribute as dhcp6-ll-wait. Changed logic to reuse existing timeout variable to store user provided value.
This commit is contained in:
@@ -61,12 +61,12 @@ class dhcp(moduleBase):
|
|||||||
dhcp_wait = policymanager.policymanager_api.get_attr_default(
|
dhcp_wait = policymanager.policymanager_api.get_attr_default(
|
||||||
module_name=self.__class__.__name__, attr='dhcp-wait')
|
module_name=self.__class__.__name__, attr='dhcp-wait')
|
||||||
wait = not str(dhcp_wait).lower() == "no"
|
wait = not str(dhcp_wait).lower() == "no"
|
||||||
inet6_ll_wait = policymanager.policymanager_api.get_iface_default(module_name=self.__class__.__name__, \
|
dhcp6_ll_wait = policymanager.policymanager_api.get_iface_default(module_name=self.__class__.__name__, \
|
||||||
ifname=ifaceobj.name, attr='inet6-ll-wait')
|
ifname=ifaceobj.name, attr='dhcp6-ll-wait')
|
||||||
try:
|
try:
|
||||||
ll_wait_time = int(inet6_ll_wait)
|
timeout = int(dhcp6_ll_wait)+1
|
||||||
except:
|
except:
|
||||||
ll_wait_time = 10
|
timeout = 10
|
||||||
pass
|
pass
|
||||||
|
|
||||||
vrf = ifaceobj.get_attr_value_first('vrf')
|
vrf = ifaceobj.get_attr_value_first('vrf')
|
||||||
@@ -108,11 +108,8 @@ class dhcp(moduleBase):
|
|||||||
pass
|
pass
|
||||||
#add delay before starting IPv6 dhclient to
|
#add delay before starting IPv6 dhclient to
|
||||||
#make sure the configured interface/link is up.
|
#make sure the configured interface/link is up.
|
||||||
if ll_wait_time:
|
if timeout > 1:
|
||||||
timeout = ll_wait_time
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
|
||||||
timeout = ll_wait_time+1
|
|
||||||
|
|
||||||
while timeout:
|
while timeout:
|
||||||
addr_output = utils.exec_command('%s -6 addr show %s'
|
addr_output = utils.exec_command('%s -6 addr show %s'
|
||||||
|
|||||||
Reference in New Issue
Block a user