--- a/bin/pvl.hosts-import Thu Dec 19 20:06:37 2013 +0200
+++ b/bin/pvl.hosts-import Thu Dec 19 21:12:07 2013 +0200
@@ -82,6 +82,9 @@
parser.add_option('--output-domain', metavar='DOMAIN',
help="Select hosts by domain")
+ parser.add_option('--output-others', action='store_true',
+ help="Negate selection")
+
# defaults
parser.set_defaults(
import_zone_hosts = [],
@@ -659,15 +662,22 @@
sort = ipaddr.IPAddress(0)
# select
+ match = True
+
if prefix:
if not (ip and ip in prefix) :
- continue
+ match = False
if select_domain :
if not (domain and domain == select_domain) :
- continue
+ match = False
- yield (domain, sort), (host, domain), fields
+ if match and options.output_others :
+ pass
+ elif not match and not options.output_others :
+ pass
+ else :
+ yield (domain, sort), (host, domain), fields
def export_hosts (options, hosts) :
"""