[PATCH 13/13] Always pass a return value to dhclient-script.py
Matthew W. S. Bell
matthew at bells23.org.uk
Sat Apr 25 18:18:38 UTC 2009
From: Matthew W. S. Bell <mentor at engelbert.(none)>
Signed-off-by: Matthew W. S. Bell <matthew at bells23.org.uk>
---
src/netconf/ifaces/dhcp/dhcp3_client.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/netconf/ifaces/dhcp/dhcp3_client.py b/src/netconf/ifaces/dhcp/dhcp3_client.py
index 1d00e40..0eba441 100644
--- a/src/netconf/ifaces/dhcp/dhcp3_client.py
+++ b/src/netconf/ifaces/dhcp/dhcp3_client.py
@@ -86,7 +86,10 @@ class dhclient3Reactor(BaseBufferedFdReactor):
ret = fn(data)
result = dhclient3Reactor.DHCPResult(reason)
else:
+ ret = 0
result = dhclient3Reactor.UnknownReason(reason)
+
+ print >>self._dhclientfile, "%d" % ret
self._log.debug('calling %s with result %s...' % (self._cb_result,
result))
self._cb_result(result)
@@ -135,8 +138,7 @@ class dhclient3Reactor(BaseBufferedFdReactor):
@protected
def _react_to_PREINIT(self, data):
#TODO: $medium and $alias_ip_address
- ret = self._manip.bring_iface_up(self._iface)
- print >>self._dhclientfile, ret
+ return self._manip.bring_iface_up(self._iface)
# BOUND
# The DHCP client has done an initial binding to a new address.
@@ -192,6 +194,7 @@ class dhclient3Reactor(BaseBufferedFdReactor):
self._manip.add_dns(self._iface, data.get('new_domain_name_servers'),
data.get('new_domain_name'),
data.get('new_domain_search'))
+ return 0
# RENEW
@@ -226,6 +229,7 @@ class dhclient3Reactor(BaseBufferedFdReactor):
self._relinquish_old_lease(data)
self._manip.bring_iface_down(self._iface)
self._manip.remove_dns(self._iface)
+ return 0
# FAIL
# The DHCP client has been unable to contact any DHCP servers,
@@ -237,6 +241,7 @@ class dhclient3Reactor(BaseBufferedFdReactor):
self._relinquish_old_lease(data)
self._manip.bring_iface_down(self._iface)
self._manip.remove_dns(self._iface)
+ return 0
# STOP
# The dhclient has been informed to shut down gracefully, the
@@ -247,6 +252,7 @@ class dhclient3Reactor(BaseBufferedFdReactor):
self._relinquish_old_lease(data)
self._manip.bring_iface_down(self._iface)
self._manip.remove_dns(self._iface)
+ return 0
# RELEASE
# The dhclient has been executed using the -r flag, indicating that
@@ -257,6 +263,7 @@ class dhclient3Reactor(BaseBufferedFdReactor):
self._relinquish_old_lease(data)
self._manip.bring_iface_down(self._iface)
self._manip.remove_dns(self._iface)
+ return 0
# NBI
# No-Broadcast-Interfaces...dhclient was unable to find any
--
1.6.2.4
More information about the netconf-devel
mailing list