Commit 228d0e74 authored by Michael Tremer's avatar Michael Tremer

location-query: Require at least one flag

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 9df8db2a
......@@ -246,7 +246,13 @@ class CLI(object):
args.family = 0
# Call function
ret = args.func(db, args)
try:
ret = args.func(db, args)
# Catch invalid inputs
except ValueError as e:
sys.stderr.write("%s\n" % e)
ret = 2
# Return with exit code
if ret:
......@@ -451,6 +457,9 @@ class CLI(object):
if ns.anycast:
flags |= location.NETWORK_FLAG_ANYCAST
if not flags:
raise ValueError(_("You must at least pass one flag"))
with self.__get_output_formatter(ns) as f:
for n in db.search_networks(flags=flags, family=ns.family):
f.network(n)
......
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