]> git.ipfire.org Git - location/libloc.git/commitdiff
importer: Walk through all options for flags
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Jun 2020 13:28:06 +0000 (13:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Jun 2020 13:28:06 +0000 (13:28 +0000)
It could happen that a network was marked, but the AS was not.

Since the AS is checked first, we won't check the network and
therefore write the wrong information into the database.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location-importer.in

index d412f104edb63aa4b7265a5a13cc08e0142155ec..05324b74abfab5eb4f351dcb17089721ba8f8fbf 100644 (file)
@@ -171,9 +171,9 @@ class CLI(object):
                                        number bigint NOT NULL,
                                        name text,
                                        country text,
-                                       is_anonymous_proxy boolean DEFAULT FALSE,
-                                       is_satellite_provider boolean DEFAULT FALSE,
-                                       is_anycast boolean DEFAULT FALSE
+                                       is_anonymous_proxy boolean,
+                                       is_satellite_provider boolean,
+                                       is_anycast boolean
                                );
                                CREATE UNIQUE INDEX IF NOT EXISTS autnum_overrides_number
                                        ON autnum_overrides(number);
@@ -181,9 +181,9 @@ class CLI(object):
                                CREATE TABLE IF NOT EXISTS network_overrides(
                                        network inet NOT NULL,
                                        country text,
-                                       is_anonymous_proxy boolean DEFAULT FALSE,
-                                       is_satellite_provider boolean DEFAULT FALSE,
-                                       is_anycast boolean DEFAULT FALSE
+                                       is_anonymous_proxy boolean,
+                                       is_satellite_provider boolean,
+                                       is_anycast boolean
                                );
                                CREATE UNIQUE INDEX IF NOT EXISTS network_overrides_network
                                        ON network_overrides(network);
@@ -267,7 +267,8 @@ class CLI(object):
                                        (
                                                SELECT is_anonymous_proxy FROM autnum_overrides overrides
                                                        WHERE announcements.autnum = overrides.number
-                                       )
+                                       ),
+                                       FALSE
                                ) AS is_anonymous_proxy,
                                COALESCE(
                                        (
@@ -279,7 +280,8 @@ class CLI(object):
                                        (
                                                SELECT is_satellite_provider FROM autnum_overrides overrides
                                                        WHERE announcements.autnum = overrides.number
-                                       )
+                                       ),
+                                       FALSE
                                ) AS is_satellite_provider,
                                COALESCE(
                                        (
@@ -291,7 +293,8 @@ class CLI(object):
                                        (
                                                SELECT is_anycast FROM autnum_overrides overrides
                                                        WHERE announcements.autnum = overrides.number
-                                       )
+                                       ),
+                                       FALSE
                                ) AS is_anycast
                        FROM announcements
                                LEFT JOIN networks ON announcements.network <<= networks.network