From: Michael Tremer Date: Tue, 7 Jan 2020 17:31:21 +0000 (+0000) Subject: tools: Skip everything that isn't assigned (yet) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e7ac6152a13c746334374214b818052923d1ab5;p=location%2Flocation-database.git tools: Skip everything that isn't assigned (yet) Signed-off-by: Michael Tremer --- diff --git a/tools/base.py b/tools/base.py index 676f3c1..fdd862f 100644 --- a/tools/base.py +++ b/tools/base.py @@ -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,