Commit 671e149e authored by Michael Tremer's avatar Michael Tremer

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: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 85e44d9a
......@@ -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):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment