From: Michael Tremer Date: Mon, 3 Jul 2023 14:53:50 +0000 (+0000) Subject: location: Fix correct set name when family is selected X-Git-Tag: 0.9.17~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76852f60da75827f1296358e6be511a04355d073;p=location%2Flibloc.git location: Fix correct set name when family is selected This does however not fix the problem if no --family= parameter is being given because we will then export for multiple families in one file. This is for example not supported for ipset. Fixes: #12897 Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location.in b/src/scripts/location.in index be13156..60b11d6 100644 --- a/src/scripts/location.in +++ b/src/scripts/location.in @@ -514,7 +514,7 @@ class CLI(object): writer = self.__get_output_formatter(ns) for asn in ns.asn: - f = writer("AS%s" % asn, f=sys.stdout) + f = writer("AS%s" % asn, family=ns.family, f=sys.stdout) # Print all matching networks for n in db.search_networks(asns=[asn], family=ns.family): @@ -527,7 +527,7 @@ class CLI(object): for country_code in ns.country_code: # Open standard output - f = writer(country_code, f=sys.stdout) + f = writer(country_code, family=ns.family, f=sys.stdout) # Print all matching networks for n in db.search_networks(country_codes=[country_code], family=ns.family): @@ -554,7 +554,7 @@ class CLI(object): raise ValueError(_("You must at least pass one flag")) writer = self.__get_output_formatter(ns) - f = writer("custom", f=sys.stdout) + f = writer("custom", family=ns.family, f=sys.stdout) for n in db.search_networks(flags=flags, family=ns.family): f.write(n) @@ -563,7 +563,7 @@ class CLI(object): def handle_list_bogons(self, db, ns): writer = self.__get_output_formatter(ns) - f = writer("bogons", f=sys.stdout) + f = writer("bogons", family=ns.family, f=sys.stdout) for n in db.list_bogons(family=ns.family): f.write(n)