]> git.ipfire.org Git - location/location-database.git/commitdiff
tools: Skip everything that isn't assigned (yet)
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Jan 2020 17:31:21 +0000 (17:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Jan 2020 17:31:21 +0000 (17:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tools/base.py

index 676f3c1048957ee3f4d7951e1199c6a349347705..fdd862f1d4de11957b7e0ef020c18618b58908a3 100644 (file)
@@ -238,6 +238,10 @@ class RIRParser(object):
                if country_code == "*":
                        return
 
+               # Skip any lines with addresses that are not allocated
+               #if not "|allocated|" in line and not "|assigned|" in line:
+               #       return
+
                if type in ("ipv6", "ipv4"):
                        return self._parse_ip_line(country_code, type, line)
 
@@ -255,6 +259,10 @@ class RIRParser(object):
                        logging.warning("Unhandled line format: %s" % line)
                        return
 
+               # Skip anything that isn't properly assigned
+               if not status in ("assigned", "allocated"):
+                       return
+
                # Cast prefix into an integer
                try:
                        prefix = int(prefix)
@@ -297,6 +305,10 @@ class RIRParser(object):
                        logging.warning("Could not parse line: %s" % line)
                        return
 
+               # Skip anything that isn't properly assigned
+               if not status in ("assigned", "allocated"):
+                       return
+
                with self.db as c:
                        args = (
                                asn,