]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
unbound-dhcp-leases-bridge: Initialize at startup
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 May 2024 13:25:53 +0000 (14:25 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 May 2024 13:25:53 +0000 (14:25 +0100)
When the process starts, we will now load all static hosts and leases
and reload Unbound to have a defined state to start with.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/unbound/unbound-dhcp-leases-bridge

index d6b39bfc2bdd62d70ea244529aaaa0a5df6be479..99e5672b4dcec592ac549a9ed807ee63f7524cf1 100644 (file)
@@ -98,6 +98,12 @@ class UnboundDHCPLeasesBridge(object):
                self.unbound = UnboundConfigWriter(unbound_leases_file)
                self.running = False
 
+               # Read all static hosts
+               self.hosts = self.read_static_hosts()
+
+               # Unconditionally update all leases and reload Unbound
+               self.update_dhcp_leases()
+
        def run(self):
                log.info("Unbound DHCP Leases Bridge started on %s" % self.leases_file)
                self.running = True