Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 100 lines (84 sloc) 3.192 kb
#!/usr/bin/env python2.7
import sys
import argparse
sys.path.insert(0, "./")
from invdns.options import *
from invdns.intr_options import *
from invdns.dispatch import build_dns_parsers, dispatch
from gettext import gettext as _
import pdb
"""
# Records #
# A, AAAA, PTR, CNAME, MX, NS, SRV, TXT, SSHFP and SOA
# NS Record
(ns_action_parser, ns_create_parser, ns_update_parser,
ns_delete_parser) = dns_command_template('NS')
# Create NS Record options
args = [add_domain_argument,
add_ttl_argument,
add_target_argument,
add_view_arguments,
add_description_argument]
map(lambda apply_arg: apply_arg(ns_create_parser), args)
# Update NS Record options
add_update_pk_argument(ns_update_parser, 'NS')
map(lambda apply_arg: apply_arg(ns_update_parser, required=False), args)
# Delete NS Record options
add_delete_pk_argument(ns_delete_parser, 'NS')
# SSHFP Record
(sshfp_action_parser, sshfp_create_parser, sshfp_update_parser,
sshfp_delete_parser) = dns_command_template('SSHFP')
# Create SSHFP Record options
args = [add_label_argument,
add_domain_argument,
add_fqdn_argument,
add_ttl_argument,
add_algorithm_argument,
add_fingerprint_argument,
add_key_argument,
add_view_arguments,
add_description_argument]
map(lambda apply_arg: apply_arg(sshfp_create_parser), args)
# Update SSHFP Record options
add_update_pk_argument(sshfp_update_parser, 'SSHFP')
map(lambda apply_arg: apply_arg(sshfp_update_parser, required=False), args)
# Delete SSHFP Record options
add_delete_pk_argument(sshfp_delete_parser, 'SSHFP')
# INTR Record
(intr_action_parser, intr_create_parser, intr_update_parser,
intr_delete_parser) = dns_command_template('INTR')
# Create INTR Record options
args = [add_label_argument,
add_domain_argument,
add_fqdn_argument,
add_ttl_argument,
add_ip_argument,
add_itype_argument,
add_view_arguments,
add_dns_enable,
add_dhcp_enable,
add_system_argument,
add_description_argument]
map(lambda apply_arg: apply_arg(intr_create_parser), args)
# Update INTR Record options
add_update_pk_argument(intr_update_parser, 'INTR')
map(lambda apply_arg: apply_arg(intr_update_parser, required=False), args)
# Delete INTR Record options
add_delete_pk_argument(intr_delete_parser, 'INTR')
"""
if __name__ == "__main__":
inv_parser = argparse.ArgumentParser(prog='invdns')
format_group = inv_parser.add_mutually_exclusive_group()
format_group.add_argument('--json', default=False, dest='p_json',
help="Format the output as JSON",
action='store_true')
format_group.add_argument('--silent', default=False, dest='p_silent',
help="Silence all stdout and stderr",
action='store_true')
base_parser = inv_parser.add_subparsers(dest='dtype')
build_dns_parsers(base_parser)
nas = inv_parser.parse_args(sys.argv[1:])
resp_code, resp_list = dispatch(nas)
if not nas.p_silent and resp_list:
print '\n'.join(resp_list),
sys.exit(resp_code)
Jump to Line
Something went wrong with that request. Please try again.