Merge remote-tracking branch 'origin/4.14'

This commit is contained in:
Rohit Yadav 2020-12-14 14:41:06 +05:30
commit 58a0a7b1a3
1 changed files with 10 additions and 0 deletions

View File

@ -40,6 +40,7 @@ class CsDhcp(CsDataBag):
self.cloud = CsFile(DHCP_HOSTS)
self.dhcp_opts = CsFile(DHCP_OPTS)
self.conf = CsFile(CLOUD_CONF)
self.dhcp_leases = CsFile(LEASES)
self.cloud.repopulate()
self.dhcp_opts.repopulate()
@ -60,6 +61,9 @@ class CsDhcp(CsDataBag):
if self.cloud.commit():
restart_dnsmasq = True
if self.dhcp_leases.commit():
restart_dnsmasq = True
self.dhcp_opts.commit()
if restart_dnsmasq:
@ -186,6 +190,9 @@ class CsDhcp(CsDataBag):
entry['ipv4_address'],
entry['host_name'],
lease))
self.dhcp_leases.search(entry['mac_address'], "0 %s %s %s *" % (entry['mac_address'],
entry['ipv4_address'],
entry['host_name']))
else:
tag = entry['ipv4_address'].replace(".", "_")
self.cloud.add("%s,set:%s,%s,%s,%s" % (entry['mac_address'],
@ -196,6 +203,9 @@ class CsDhcp(CsDataBag):
self.dhcp_opts.add("%s,%s" % (tag, 3))
self.dhcp_opts.add("%s,%s" % (tag, 6))
self.dhcp_opts.add("%s,%s" % (tag, 15))
self.dhcp_leases.search(entry['mac_address'], "0 %s %s %s *" % (entry['mac_address'],
entry['ipv4_address'],
entry['host_name']))
i = IPAddress(entry['ipv4_address'])
# Calculate the device