1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: address: fix call to dhclient is_running

Ticket: CM-10857
Reviewed By: julien, nikhil
Testing Done: Tested moving from a static to dhcp addr method for eth0

the check to see if dhclient is running on an interface was failing.
which caused the following problem:
- interface when moved from dhcp to static addr_method was
not killing the existing dhcp process
- and a subsequent move from static to dhcp addr_method quit starting
dhcp because a dhclient process was already running
- but the original dhcp ip was already removed because of the
static address config which leaves eth0 in a weird state

After this patch:
- move from dhcp to static addr_method will release any
existing dhcp leases on an interface
- a subsequent move from static to dhcp will request a new
dhcp lease

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
Roopa Prabhu
2016-05-09 13:50:56 -07:00
parent 48689b55e8
commit 7c1135eae3

View File

@@ -249,10 +249,10 @@ class address(moduleBase):
# any sibling iface objects, kill any stale dhclient
# processes
dhclientcmd = dhclient()
if dhclient.is_running(ifaceobj.name):
if dhclientcmd.is_running(ifaceobj.name):
# release any dhcp leases
dhclientcmd.release(ifaceobj.name)
elif dhclient.is_running6(ifaceobj.name):
elif dhclientcmd.is_running6(ifaceobj.name):
dhclientcmd.release6(ifaceobj.name)
except:
pass