Example #1
0
def parse_arguments(argv):
    long_opts = [
        'aggressive=', 'auto', 'binary', 'continue=', 'end=', 'help',
        'ignore-overlapping', 'input=', 'label-counter=', 'ldh', 'limit-rate=',
        'max-retries=', 'mixed', 'nsec', 'nsec3', 'omit-soa-check', 'output=',
        'predict', 'processes=', 'query-mode=', 'queue-element-size=', 'quiet',
        'start=', 'timeout=', 'no-openssl', 'verbose', 'version'
    ]
    options = default_options()
    opts = '3AMNabc:e:f:hi:lm:no:pqs:v'
    try:
        opts, args = getopt.gnu_getopt(argv[1:], opts, long_opts)
    except getopt.GetoptError, err:
        log.fatal_exit(2, err, "\n", "Try `", str(os.path.basename(argv[0])),
                       " --help' for more information.")
Example #2
0
def parse_arguments(argv):
    long_opts = [
            'aggressive=',
            'auto',
            'binary',
            'continue=',
            'end=',
            'help',
            'ignore-overlapping',
            'input=',
            'label-counter=',
            'ldh',
            'limit-rate=',
            'max-retries=',
            'mixed',
            'nsec',
            'nsec3',
            'omit-soa-check',
            'omit-dnskey-check',
            'detection-attempts=',
            'output=',
            'predict',
            'processes=',
            'query-mode=',
            'queue-element-size=',
            'quiet',
            'start=',
            'timeout=',
            'no-openssl',
            'verbose',
            'version'
    ]
    options = default_options()
    opts = '3AMNabc:e:f:hi:lm:no:pqs:v'
    try:
        opts, args = getopt.gnu_getopt(argv[1:], opts, long_opts)
    except getopt.GetoptError, err:
        log.fatal_exit(2, err, "\n", "Try `",
                str(os.path.basename(argv[0])), 
                " --help' for more information.")
Example #3
0
def main(argv):
    log.logger = log.Logger()
    try:
        (options, nslist, zone) = parse_arguments(argv)
    except N3MapError, e:
        log.fatal_exit(2, e)
Example #4
0
def invalid_argument(opt, arg):
    log.fatal_exit(2, "invalid " + opt + " argnument `" + str(arg) + "'")
Example #5
0
        elif opt in ('--no-openssl',):
            options['use_openssl'] = False

        elif opt in ('-v', '--verbose'):
            log.logger.loglevel += 1

        elif opt in ('--version'):
            version()
            sys.exit(0)

        else:
            invalid_argument(opt, "")

    if len(args) < 1:
        log.fatal_exit(2, 'missing arguments', "\n", "Try `",
                str(os.path.basename(argv[0])), 
                " --help' for more information.")
    else:
        zone = n3map.name.fqdn_from_text(args[-1])
        if len(args) >= 2:
            ns_names = args[:-1]
            nslist = queryprovider.nameserver_from_text(*ns_names)
        else:
            ns_names = query_ns_records(zone)
            nslist = queryprovider.nameserver_from_text(*ns_names)
            for ns in nslist:
                log.info("using nameserver: ", str(ns))

    return (options, nslist, zone)

def version():
Example #6
0
def main(argv):
    log.logger = log.Logger()
    try:
        (options, nslist, zone) = parse_arguments(argv)
    except N3MapError, e:
        log.fatal_exit(2, e)
Example #7
0
def invalid_argument(opt, arg):
    log.fatal_exit(2, "invalid " + opt + " argnument `" + str(arg) + "'")
Example #8
0
        elif opt in ('--no-openssl', ):
            options['use_openssl'] = False

        elif opt in ('-v', '--verbose'):
            log.logger.loglevel += 1

        elif opt in ('--version'):
            version()
            sys.exit(0)

        else:
            invalid_argument(opt, "")

    if len(args) < 1:
        log.fatal_exit(2, 'missing arguments', "\n", "Try `",
                       str(os.path.basename(argv[0])),
                       " --help' for more information.")
    else:
        zone = n3map.name.fqdn_from_text(args[-1])
        if len(args) >= 2:
            ns_names = args[:-1]
            nslist = queryprovider.nameserver_from_text(*ns_names)
        else:
            ns_names = query_ns_records(zone)
            nslist = queryprovider.nameserver_from_text(*ns_names)
            for ns in nslist:
                log.info("using nameserver: ", str(ns))

    return (options, nslist, zone)