Commit a few more bugs

This commit is contained in:
Joshua Boniface 2018-10-04 00:04:48 -04:00
parent d1ef073a8e
commit 7d33e2d154
1 changed files with 11 additions and 5 deletions

View File

@ -156,14 +156,20 @@ class VXNetworkInstance():
) )
) )
entry = '{},{}'.format(reservation, ipaddr) entry = '{},{}'.format(reservation, ipaddr)
with open(filename, 'w') as outfile: outfile = open(filename, 'w')
outfile.write(entry) outfile.write(entry)
outfile.close()
for reservation in self.dhcp_reservations: for reservation in self.dhcp_reservations:
if reservation not in reservations: if reservation not in reservations:
filename = '{}/{}'.format(self.dnsmasq_hostsdir, reservation) filename = '{}/{}'.format(self.dnsmasq_hostsdir, reservation)
# Remove old reservation file # Remove old reservation file
os.remove(filename) try:
self.dhcp_server_daemon.signal('hup') os.remove(filename)
self.dhcp_server_daemon.signal('hup')
except:
pass
self.dhcp_reservations = reservations self.dhcp_reservations = reservations
def getvni(self): def getvni(self):
@ -340,7 +346,7 @@ class VXNetworkInstance():
def stopDHCPServer(self): def stopDHCPServer(self):
if self.dhcp_server_daemon: if self.dhcp_server_daemon:
ansiiprint.echo( ansiiprint.echo(
'Stopping DHCP server on interface {} (VNI {})'.format( 'Stopping dnsmasq DHCP server on interface {} (VNI {})'.format(
self.bridge_nic, self.bridge_nic,
self.vni self.vni
), ),