From: Michael Tremer <git@ipfire.org>
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. b666975ec292fec239aa6023dc79abf5538c9d95
Date: Thu, 28 Mar 2019 14:05:23 +0000 [thread overview]
Message-ID: <20190328140524.4929F84FDB0@people01.i.ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2953 bytes --]
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, next has been updated
via b666975ec292fec239aa6023dc79abf5538c9d95 (commit)
from 35cdc506b06ed2e5fc8f7ad7fe57239eaadbda58 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b666975ec292fec239aa6023dc79abf5538c9d95
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Thu Mar 28 12:51:06 2019 +0000
unbound-dhcp-leases-bridge: Replace leases file atomically
When there is a large number of leases, writing the file may
take a long time. When unbound is re-reading its configuration
in that time, the file might syntactically incorrect.
This change writes the file first and then moves it
to the right place in one transaction.
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
-----------------------------------------------------------------------
Summary of changes:
config/rootfiles/core/130/filelists/files | 1 +
config/unbound/unbound-dhcp-leases-bridge | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
Difference in files:
diff --git a/config/rootfiles/core/130/filelists/files b/config/rootfiles/core/130/filelists/files
index 28a32a7c6..ab1e82fcb 100644
--- a/config/rootfiles/core/130/filelists/files
+++ b/config/rootfiles/core/130/filelists/files
@@ -18,6 +18,7 @@ usr/local/bin/ipsec-interfaces
usr/local/bin/suricatactrl
usr/local/bin/update-ids-ruleset
usr/sbin/convert-snort
+usr/sbin/unbound-dhcp-leases-bridge
var/ipfire/backup/bin/backup.pl
var/ipfire/backup/include
var/ipfire/general-functions.pl
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge
index 54cd8135b..a8cd837bb 100644
--- a/config/unbound/unbound-dhcp-leases-bridge
+++ b/config/unbound/unbound-dhcp-leases-bridge
@@ -25,9 +25,11 @@ import daemon
import ipaddress
import logging
import logging.handlers
+import os
import re
import signal
import subprocess
+import tempfile
import inotify.adapters
@@ -519,11 +521,15 @@ class UnboundConfigWriter(object):
self._cached_leases.append(l)
def write_dhcp_leases(self, leases):
- with open(self.path, "w") as f:
+ with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
+ filename = f.name
+
for l in leases:
for rr in l.rrset:
f.write("local-data: \"%s\"\n" % " ".join(rr))
+ os.rename(filename, self.path)
+
def _control(self, *args):
command = ["unbound-control"]
command.extend(args)
hooks/post-receive
--
IPFire 2.x development tree
reply other threads:[~2019-03-28 14:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190328140524.4929F84FDB0@people01.i.ipfire.org \
--to=git@ipfire.org \
--cc=ipfire-scm@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox