From: Michael Tremer Date: Fri, 12 Aug 2022 13:56:17 +0000 (+0000) Subject: importer: Move importing extended sources/ARIN into transaction X-Git-Tag: 0.9.14~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=671e149e96a0f7e27cbe466d31f80545c37ebbc0;p=location%2Flibloc.git importer: Move importing extended sources/ARIN into transaction All imports should have been conducted in one large transaction so that we can remove any previous data. This was not the case because of an indentation issue and could have caused that the transaction was commited without all data being successfully re-imported. Fixes: #12852 Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 01470f7..b242275 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -512,16 +512,15 @@ class CLI(object): ON CONFLICT (number) DO UPDATE SET name = excluded.name; """) - # Download all extended sources - for source_key in location.importer.EXTENDED_SOURCES: - for single_url in location.importer.EXTENDED_SOURCES[source_key]: - with self.db.transaction(): + # Download all extended sources + for source_key in location.importer.EXTENDED_SOURCES: + for single_url in location.importer.EXTENDED_SOURCES[source_key]: # Download data for line in downloader.request_lines(single_url): self._parse_line(line, source_key, validcountries) - # Download and import (technical) AS names from ARIN - self._import_as_names_from_arin() + # Download and import (technical) AS names from ARIN + self._import_as_names_from_arin() def _check_parsed_network(self, network): """