diff --git a/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/dnsmasq_watcher.py b/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/dnsmasq_watcher.py index e73dcf740..6783220d0 100755 --- a/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/dnsmasq_watcher.py +++ b/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/dnsmasq_watcher.py @@ -51,7 +51,7 @@ import ipaddress import xml.etree.ElementTree as ET sys.path.insert(0, "/usr/local/opnsense/site-python") -from daemonize import Daemonize +from daemonize import Daemonize # noqa: E402 LEASE_FILE = '/var/db/dnsmasq.leases' STATIC_HOSTS_FILE = '/var/etc/dnsmasq-hosts' @@ -632,7 +632,10 @@ class DnsmasqLeaseWatcher: "Unbound remote control not enabled or Unbound stopped" ) else: - self.log(f"unbound-control failed ({self.consecutive_failures}/{MAX_CONSECUTIVE_FAILURES}): {stderr}", syslog.LOG_WARNING) + self.log( + f"unbound-control failed ({self.consecutive_failures}/" + f"{MAX_CONSECUTIVE_FAILURES}): {stderr}", syslog.LOG_WARNING + ) else: self.log(f"unbound-control error: {stderr}", syslog.LOG_WARNING) return False @@ -647,7 +650,10 @@ class DnsmasqLeaseWatcher: "Unbound repeatedly timing out" ) else: - self.log(f"unbound-control timeout ({self.consecutive_failures}/{MAX_CONSECUTIVE_FAILURES})", syslog.LOG_WARNING) + self.log( + f"unbound-control timeout ({self.consecutive_failures}/" + f"{MAX_CONSECUTIVE_FAILURES})", syslog.LOG_WARNING + ) return False except Exception as e: self.consecutive_failures += 1 @@ -657,7 +663,10 @@ class DnsmasqLeaseWatcher: f"Repeated unbound-control failures: {e}" ) else: - self.log(f"unbound-control exception ({self.consecutive_failures}/{MAX_CONSECUTIVE_FAILURES}): {e}", syslog.LOG_ERR) + self.log( + f"unbound-control exception ({self.consecutive_failures}/" + f"{MAX_CONSECUTIVE_FAILURES}): {e}", syslog.LOG_ERR + ) return False def add_dns_record(self, fqdn_key, record): @@ -1077,7 +1086,10 @@ class DnsmasqLeaseWatcher: ) break else: - self.log(f"Error in watch loop ({self.consecutive_failures}/{MAX_CONSECUTIVE_FAILURES}): {e}", syslog.LOG_ERR) + self.log( + f"Error in watch loop ({self.consecutive_failures}/" + f"{MAX_CONSECUTIVE_FAILURES}): {e}", syslog.LOG_ERR + ) time.sleep(FAILURE_RETRY_DELAY) # If we exited due to failure, enter idle loop diff --git a/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/list_dnsmasq_records.py b/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/list_dnsmasq_records.py index 45e139a5c..f78be9ed8 100755 --- a/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/list_dnsmasq_records.py +++ b/dns/dnsmasq-to-unbound/src/opnsense/scripts/unbound/list_dnsmasq_records.py @@ -330,7 +330,9 @@ def get_records(): 'ip': lease['ip'], 'type': 'lease', 'mac': lease['mac'], - 'expiry': 'infinite' if lease['expiry'] == 0 else time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(lease['expiry'])), + 'expiry': 'infinite' if lease['expiry'] == 0 else time.strftime( + '%Y-%m-%d %H:%M:%S', time.localtime(lease['expiry']) + ), 'expiry_ts': lease['expiry'] # For comparison } # Handle duplicates with conflict resolution