Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
libloc
Commits
f1fb21bd
Commit
f1fb21bd
authored
Mar 05, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
location: Fix output of list-* commands
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
b767db8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
src/python/export.py
src/python/export.py
+4
-2
src/python/location.in
src/python/location.in
+4
-4
No files found.
src/python/export.py
View file @
f1fb21bd
...
...
@@ -47,13 +47,15 @@ class OutputWriter(object):
# Enable network flattening (i.e. networks cannot overlap)
flatten
=
False
def
__init__
(
self
,
name
,
family
=
None
,
directory
=
None
):
def
__init__
(
self
,
name
,
family
=
None
,
directory
=
None
,
f
=
None
):
self
.
name
=
name
self
.
family
=
family
self
.
directory
=
directory
# Open output file
if
self
.
directory
:
if
f
:
self
.
f
=
f
elif
self
.
directory
:
self
.
f
=
open
(
self
.
filename
,
self
.
mode
)
elif
"b"
in
self
.
mode
:
self
.
f
=
io
.
BytesIO
()
...
...
src/python/location.in
View file @
f1fb21bd
...
...
@@ -514,7 +514,7 @@ class CLI(object):
writer
=
self
.
__get_output_formatter
(
ns
)
for
asn
in
ns
.
asn
:
f
=
writer
(
sys
.
stdout
,
prefix
=
"AS%s"
%
asn
)
f
=
writer
(
"AS%s"
%
asn
,
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
(
sys
.
stdout
,
prefix
=
country_code
)
f
=
writer
(
country_code
,
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
(
sys
.
stdout
,
prefix
=
"custom"
)
f
=
writer
(
"custom"
,
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
(
sys
.
stdout
,
prefix
=
"bogons"
)
f
=
writer
(
"bogons"
,
f
=
sys
.
stdout
)
for
n
in
db
.
list_bogons
(
family
=
ns
.
family
):
f
.
write
(
n
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment