Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/unbound/unbound-dhcp-leases-bridge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 986fae2d2..bc944a073 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -276,7 +276,7 @@ class UnboundDHCPLeasesBridge(object): if lease.has_expired(): log.debug(" Expired")
- self.unbound.update_dhcp_leases(self.leases) + self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()])
def _add_lease(self, lease): # Skip leases without an FQDN
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()])
def _add_lease(self, lease): - # Skip leases without an FQDN + # Skip leases without a FQDN if not lease.fqdn: - log.debug("Skipping lease without an FQDN: %s" % lease) + log.debug("Skipping lease without a FQDN: %s" % lease) return
# Skip any leases that also are a static host
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()])
def _add_lease(self, lease):
# Skip leases without an FQDN
if not lease.fqdn:# Skip leases without a FQDN
log.debug("Skipping lease without an FQDN: %s" % lease)
log.debug("Skipping lease without a FQDN: %s" % lease) return
# Skip any leases that also are a static host
Technically, I think this update is incorrect and "an" is correct - https://www.reddit.com/r/grammar/comments/riql6s/a_or_an_before_acronym_that... and https://www.grammar.com/a-vs-an-when-to-use. But TBH, I really don't think it is too important.
Nick
On 21/10/2024 17:44, Bernhard Bitsch wrote:
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()]) def _add_lease(self, lease): - # Skip leases without an FQDN + # Skip leases without a FQDN if not lease.fqdn: - log.debug("Skipping lease without an FQDN: %s" % lease) + log.debug("Skipping lease without a FQDN: %s" % lease) return # Skip any leases that also are a static host
I felt that “an” was correct, too. But only when I say it out loud :)
I am happy to have this patch dropped.
On 21 Oct 2024, at 18:14, Nick Howitt nick@howitts.co.uk wrote:
Technically, I think this update is incorrect and "an" is correct - https://www.reddit.com/r/grammar/comments/riql6s/a_or_an_before_acronym_that... and https://www.grammar.com/a-vs-an-when-to-use. But TBH, I really don't think it is too important.
Nick
On 21/10/2024 17:44, Bernhard Bitsch wrote:
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()]) def _add_lease(self, lease):
# Skip leases without an FQDN
# Skip leases without a FQDN if not lease.fqdn:
log.debug("Skipping lease without an FQDN: %s" % lease)
log.debug("Skipping lease without a FQDN: %s" % lease) return # Skip any leases that also are a static host
If this is any help, I also always use “an” when in combination with an acronym that is pronounced with a vowel sound. I’d also say it isn’t terribly important, as mentioned already by Nick, and it doesn’t stick out to me as an error either way.
FWIW, the same rule does apply with letter sounds: “an F” is the same as “an eff”.
“…an FQDN…” “…an SOP…”
“…a PDF…” “…a BFH…”
I do wonder about “UFO”, and I wouldn’t say “an UFO”, so your guess is as good as mine there.
I don’t think I cleared that up at all, but it’s English, so that’s probably par for the course and a sign I’m on the right track.
Tom
On Oct 21, 2024, at 1:14 PM, Nick Howitt nick@howitts.co.uk wrote:
Technically, I think this update is incorrect and "an" is correct - https://www.reddit.com/r/grammar/comments/riql6s/a_or_an_before_acronym_that... and https://www.grammar.com/a-vs-an-when-to-use. But TBH, I really don't think it is too important.
Nick
On 21/10/2024 17:44, Bernhard Bitsch wrote:
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org mailto:bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org mailto:michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()]) def _add_lease(self, lease):
# Skip leases without an FQDN
# Skip leases without a FQDN if not lease.fqdn:
log.debug("Skipping lease without an FQDN: %s" % lease)
log.debug("Skipping lease without a FQDN: %s" % lease) return # Skip any leases that also are a static host
If I understand the rules cited, is it a user or an user? Just to choose an example, which is apparent frequently.
On 21.10.24 21:38, Tom Rymes tom@rymes.net wrote:
If this is any help, I also always use “an” when in combination with an acronym that is pronounced with a vowel sound. I’d also say it isn’t terribly important, as mentioned already by Nick, and it doesn’t stick out to me as an error either way.
FWIW, the same rule does apply with letter sounds: “an F” is the same as “an eff”.
“…an FQDN…” “…an SOP…”
“…a PDF…” “…a BFH…”
I do wonder about “UFO”, and I wouldn’t say “an UFO”, so your guess is as good as mine there.
I don’t think I cleared that up at all, but it’s English, so that’s probably par for the course and a sign I’m on the right track.
Tom
On Oct 21, 2024, at 1:14 PM, Nick Howitt nick@howitts.co.uk wrote:
Technically, I think this update is incorrect and "an" is correct - https://www.reddit.com/r/grammar/comments/riql6s/a_or_an_before_acronym_that... and https://www.grammar.com/a-vs-an-when-to-use. But TBH, I really don't think it is too important.
Nick
On 21/10/2024 17:44, Bernhard Bitsch wrote:
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org mailto:bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org mailto:michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()]) def _add_lease(self, lease):
# Skip leases without an FQDN
# Skip leases without a FQDN if not lease.fqdn:
log.debug("Skipping lease without an FQDN: %s" % lease)
log.debug("Skipping lease without a FQDN: %s" % lease) return # Skip any leases that also are a static host
It’s “a user”, because “an” is used when the sound is a vowel sound, and the “y” sound of “user” (and “UFO” in my earlier example) is not a vowel sound, despite the fact that “u” is a vowel (and according to the rhyme I learned as a child) Y is sometimes a vowel.
Basically, a/an depends on the sound of the word when spoken, not the letter itself. Another good example would be letter sounds (again, I know I already mentioned this), where “an” is used before consonants that are sounded as vowels:
“An F”, “an H”, “an L”, “an M”, “an N”, “an R”, and “an X”
Meanwhile “a U” and “a Y”.
This link has more examples, including unsounded “H”, as in honor (which used “an”): https://owl.purdue.edu/owl/general_writing/grammar/articles_a_versus_an.html
It’s English, it’s not supposed to make sense.
Tom
On Oct 21, 2024, at 4:02 PM, bbitsch@ipfire.org wrote:
If I understand the rules cited, is it a user or an user? Just to choose an example, which is apparent frequently.
On 21.10.24 21:38, Tom Rymes tom@rymes.net wrote:
If this is any help, I also always use “an” when in combination with an acronym that is pronounced with a vowel sound. I’d also say it isn’t terribly important, as mentioned already by Nick, and it doesn’t stick out to me as an error either way. FWIW, the same rule does apply with letter sounds: “an F” is the same as “an eff”. “…an FQDN…” “…an SOP…” “…a PDF…” “…a BFH…” I do wonder about “UFO”, and I wouldn’t say “an UFO”, so your guess is as good as mine there. I don’t think I cleared that up at all, but it’s English, so that’s probably par for the course and a sign I’m on the right track. Tom
On Oct 21, 2024, at 1:14 PM, Nick Howitt nick@howitts.co.uk wrote:
Technically, I think this update is incorrect and "an" is correct - https://www.reddit.com/r/grammar/comments/riql6s/a_or_an_before_acronym_that... and https://www.grammar.com/a-vs-an-when-to-use. But TBH, I really don't think it is too important.
Nick
On 21/10/2024 17:44, Bernhard Bitsch wrote:
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org mailto:bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org mailto:michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index bc944a073..2cbdaa004 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -279,9 +279,9 @@ class UnboundDHCPLeasesBridge(object): self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()]) def _add_lease(self, lease):
# Skip leases without an FQDN
# Skip leases without a FQDN if not lease.fqdn:
log.debug("Skipping lease without an FQDN: %s" % lease)
log.debug("Skipping lease without a FQDN: %s" % lease) return # Skip any leases that also are a static host
When we import all static leases, their remark will be used as hostname (because WTF?) and might be overwritten if the device is not sending any or even the same hostname.
This patch avoids that static leases will be modified.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/unbound/unbound-dhcp-leases-bridge | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 2cbdaa004..66ea28054 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -216,6 +216,11 @@ class UnboundDHCPLeasesBridge(object): # Find the old lease old_lease = self._find_lease(address)
+ # Don't update fixed leases as they might clear the hostname + if old_lease and old_lease.fixed: + log.debug("Won't update fixed lease %s" % old_lease) + return + # Create a new lease lease = Lease(address, { "client-hostname" : name, @@ -581,19 +586,20 @@ class FixLeases(object): "client-hostname" : hostname, "starts" : now.strftime("%w %Y/%m/%d %H:%M:%S"), "ends" : "never", - }) + }, fixed=True) leases.append(l)
return leases
class Lease(object): - def __init__(self, ipaddr, properties): + def __init__(self, ipaddr, properties, fixed=False): if not isinstance(ipaddr, ipaddress.IPv4Address): ipaddr = ipaddress.IPv4Address(ipaddr)
self.ipaddr = ipaddr self._properties = properties + self.fixed = fixed
def __repr__(self): return "<%s for %s (%s)>" % (self.__class__.__name__, self.ipaddr, self.hostname)
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
When we import all static leases, their remark will be used as hostname (because WTF?) and might be overwritten if the device is not sending any or even the same hostname.
This patch avoids that static leases will be modified.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 2cbdaa004..66ea28054 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -216,6 +216,11 @@ class UnboundDHCPLeasesBridge(object): # Find the old lease old_lease = self._find_lease(address)
# Don't update fixed leases as they might clear the hostname
if old_lease and old_lease.fixed:
log.debug("Won't update fixed lease %s" % old_lease)
return
# Create a new lease lease = Lease(address, { "client-hostname" : name,
@@ -581,19 +586,20 @@ class FixLeases(object): "client-hostname" : hostname, "starts" : now.strftime("%w %Y/%m/%d %H:%M:%S"), "ends" : "never",
})
}, fixed=True) leases.append(l)
return leases
class Lease(object):
- def __init__(self, ipaddr, properties):
def __init__(self, ipaddr, properties, fixed=False): if not isinstance(ipaddr, ipaddress.IPv4Address): ipaddr = ipaddress.IPv4Address(ipaddr)
self.ipaddr = ipaddr self._properties = properties
self.fixed = fixed
def __repr__(self): return "<%s for %s (%s)>" % (self.__class__.__name__, self.ipaddr, self.hostname)
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/unbound/unbound-dhcp-leases-bridge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 66ea28054..4a6f9587f 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -717,7 +717,7 @@ class Lease(object): if not self.time_ends: return self.time_starts > datetime.datetime.utcnow()
- return self.time_starts > datetime.datetime.utcnow() > self.time_ends + return not self.time_starts < datetime.datetime.utcnow() < self.time_ends
@property def rrset(self):
Reviewed-by: Bernhard Bitsch bbitsch@ipfire.org
Am 21.10.2024 um 18:38 schrieb Michael Tremer:
Signed-off-by: Michael Tremer michael.tremer@ipfire.org
config/unbound/unbound-dhcp-leases-bridge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 986fae2d2..bc944a073 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -276,7 +276,7 @@ class UnboundDHCPLeasesBridge(object): if lease.has_expired(): log.debug(" Expired")
self.unbound.update_dhcp_leases(self.leases)
self.unbound.update_dhcp_leases([l for l in self.leases if not l.has_expired()])
def _add_lease(self, lease): # Skip leases without an FQDN