public inbox for location@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] location-importer: Set "is_drop" to "True" even in case of conflicts
@ 2021-12-11 18:01 Peter Müller
  0 siblings, 0 replies; only message in thread
From: Peter Müller @ 2021-12-11 18:01 UTC (permalink / raw)
  To: location

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

Previously, any present override for a given network or ASN would have
caused the SQL statement not to conduct anything at all. Since "is_drop"
is the only flag being actually set here, it makes sense to do so in
case of already present overrides as well.

The effect of this is limited: Our own override files are always
considered at last, so in case of conflicts they will be the ultima
ratio. This is an intended behaviour, but slipped my mind when I filed
bug #12728, so this patch can only be seen as a partial solution - the
rest is not a bug, but a feature. :-)

Partially fixes: #12728

Signed-off-by: Peter Müller <peter.mueller(a)ipfire.org>
---
 src/python/location-importer.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/python/location-importer.in b/src/python/location-importer.in
index b791b4d..b3e3658 100644
--- a/src/python/location-importer.in
+++ b/src/python/location-importer.in
@@ -1320,7 +1320,7 @@ class CLI(object):
 							source,
 							is_drop
 						) VALUES (%s, %s, %s)
-						ON CONFLICT (network) DO NOTHING""",
+						ON CONFLICT (network) DO UPDATE SET is_drop = True""",
 						"%s" % network,
 						"Spamhaus DROP lists",
 						True
@@ -1368,7 +1368,7 @@ class CLI(object):
 							source,
 							is_drop
 						) VALUES (%s, %s, %s)
-						ON CONFLICT (number) DO NOTHING""",
+						ON CONFLICT (number) DO UPDATE SET is_drop = True""",
 						"%s" % asn,
 						"Spamhaus ASN-DROP list",
 						True
-- 
2.26.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-11 18:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11 18:01 [PATCH] location-importer: Set "is_drop" to "True" even in case of conflicts Peter Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox