Quantum dhcp crashes if no networks exist
Fixes bug 1043583 Change-Id: Ibdfeb98c094b80ea63e79b23f14811e00525d96b
This commit is contained in:
parent
76ba706f91
commit
affa613883
@ -435,11 +435,15 @@ class DhcpLeaseRelay(object):
|
||||
def __init__(self, lease_update_callback):
|
||||
self.callback = lease_update_callback
|
||||
|
||||
try:
|
||||
os.unlink(cfg.CONF.dhcp_lease_relay_socket)
|
||||
except OSError:
|
||||
if os.path.exists(cfg.CONF.dhcp_lease_relay_socket):
|
||||
raise
|
||||
dirname = os.path.dirname(cfg.CONF.dhcp_lease_relay_socket)
|
||||
if os.path.isdir(dirname):
|
||||
try:
|
||||
os.unlink(cfg.CONF.dhcp_lease_relay_socket)
|
||||
except OSError:
|
||||
if os.path.exists(cfg.CONF.dhcp_lease_relay_socket):
|
||||
raise
|
||||
else:
|
||||
os.makedirs(dirname, 0755)
|
||||
|
||||
def _validate_field(self, value, regex):
|
||||
"""Validate value against a regular expression and return if valid."""
|
||||
|
Loading…
Reference in New Issue
Block a user