Use hostsdir for custom.list to avoid cache flushing on changes#1754
Conversation
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
yubiuser
left a comment
There was a problem hiding this comment.
Can we add one info log line to FTL.log? Currently, we only log on each modification
INFO: Writing config file
But maybe adding something like this would be useful
INFO: Updated /etc/pihole/hosts/custom.list
The old /etc/pihole/custom.list can be removed manually. I don't think we need a cleaning strategy here as only beta users will have this file as a remnant.
Why do only beta users have this file as a remnant? We are using this file in v5 already.
is a static string being printed when
Yes, but when they come from v5 after this PR is merged, the file will be read during migration and gets renamed to |
What does this implement/fix?
Use
hostsdirforcustom.listto avoid cache flushing on changes. When adding a domain into the empty list, the expected output inpihole.logis:when removing it again:
The DNS cache stays intact across these events.
It is expected to see two instead of one domain being added above if
dns.expandHostsistrueas each HOSTS entry actually adds two domains:testandtest.lan(assuming you addedtestandlanis yourdhcp/dns.domain).On a fresh migration, FTL reads
custom.listand copies it intopihole.toml. Then the file is renamed tocustom.list.bck. From this point on, FTL abandons this file and will now use/etc/pihole/hosts/custom.list. The old/etc/pihole/custom.listcan be removed manually. I don't think we need a cleaning strategy here as only beta users will have this file as a remnant. Users freshly upgrading will not see this file there once this PR got merged.One other note: I removed rotation of
custom.listas it can fully be reconstructed frompihole.toml- we should think about only rotatingpihole.toml(anddhcp.leaseson Teleporter import) in the future as the same holds true fordnsmasq.confRelated issue or feature (if applicable): N/A
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
git rebase)Checklist:
developmentalbranch.