Esempio n. 1
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "hq", ["help", "quiet"])
    except getopt.GetoptError as e:
        usage(e)

    verbose = True
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

        if opt in ('-q', '--quiet'):
            verbose = False

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        ipaddress = hubdns.update(registry.fqdn)
    except HubDNS.Error as e:
        fatal(e.description)

    if verbose:
        print("Updated %s with %s" % (registry.fqdn, ipaddress))
Esempio n. 2
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
    except getopt.GetoptError as e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        ipaddress = hubdns.get_ipaddress(registry.fqdn)
    except HubDNS.Error as e:
        fatal(e.description)

    if not ipaddress:
        ipaddress = "-"
    print("%s %s" % (registry.fqdn, ipaddress))
Esempio n. 3
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "force"])
    except getopt.GetoptError as e:
        usage(e)

    apikey = None
    force = False

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

        if opt == '--force':
            force = True

    if len(args) != 2:
        usage()

    apikey = args[0]
    fqdn = args[1]
    fqdn = fqdn if fqdn.endswith(".") else fqdn + "."

    if not force and registry.sub_apikey:
        fatal("already initialized, use --force to re-initialize")

    try:
        hubdns = HubDNS(apikey=apikey)
        subkey = hubdns.get_subkey()
    except HubDNS.Error as e:
        fatal(e.description)

    try:
        hubdns.capture(fqdn)
    except HubDNS.Error as e:
        fatal(e.description)

    if force:
        if os.path.exists(registry.path):
            shutil.rmtree(registry.path)
            os.mkdir(registry.path)

    registry.sub_apikey = subkey
    registry.fqdn = fqdn

    print("Linked HubDNS to your Hub account and set %s" % fqdn)
Esempio n. 4
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
    except getopt.GetoptError as e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        hubdns.release(registry.fqdn)
    except HubDNS.Error as e:
        fatal(e.description)

    print("Released DNS records associated with %s" % registry.fqdn)
Esempio n. 5
0
    sys.exit(1)

def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
    except getopt.GetoptError, e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        ipaddress = hubdns.get_ipaddress(registry.fqdn)
    except HubDNS.Error, e:
        fatal(e.description)

    if not ipaddress:
        ipaddress = "-"
    print "%s %s" % (registry.fqdn, ipaddress)

if __name__=="__main__":
    main()
Esempio n. 6
0
    sys.exit(1)


def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
    except getopt.GetoptError, e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        hubdns.release(registry.fqdn)
    except HubDNS.Error, e:
        fatal(e.description)

    print "Released DNS records associated with %s" % registry.fqdn


if __name__ == "__main__":
    main()
Esempio n. 7
0
def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
    except getopt.GetoptError, e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        ipaddress = hubdns.get_ipaddress(registry.fqdn)
    except HubDNS.Error, e:
        fatal(e.description)

    if not ipaddress:
        ipaddress = "-"
    print "%s %s" % (registry.fqdn, ipaddress)


if __name__ == "__main__":
    main()
Esempio n. 8
0
    print >> sys.stderr, "Syntax: %s" % sys.argv[0]
    print >> sys.stderr, __doc__.strip()
    sys.exit(1)

def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"])
    except getopt.GetoptError, e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        hubdns.release(registry.fqdn)
    except HubDNS.Error, e:
        fatal(e.description)

    print "Released DNS records associated with %s" % registry.fqdn

if __name__=="__main__":
    main()
Esempio n. 9
0
        opts, args = getopt.gnu_getopt(sys.argv[1:], "hq", ["help", "quiet"])
    except getopt.GetoptError, e:
        usage(e)

    verbose = True
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

        if opt in ('-q', '--quiet'):
            verbose = False

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        ipaddress = hubdns.update(registry.fqdn)
	upnp()
    except HubAPIError, e:
        fatal(e.description)

    if verbose:
        print "Updated %s with %s" % (registry.fqdn, ipaddress)

if __name__=="__main__":
    main()
Esempio n. 10
0
        if opt == '--force':
            force = True

    if len(args) != 2:
        usage()

    apikey = args[0]
    fqdn = args[1]
    fqdn = fqdn if fqdn.endswith(".") else fqdn + "."

    if not force and registry.sub_apikey:
        fatal("already initialized, use --force to re-initialize")

    try:
        hubdns = HubDNS(apikey=apikey)
        subkey = hubdns.get_subkey()
    except HubDNS.Error, e:
        fatal(e.description)

    try:
        hubdns.capture(fqdn)
    except HubDNS.Error, e:
        fatal(e.description)

    if force:
        if os.path.exists(registry.path):
            shutil.rmtree(registry.path)
            os.mkdir(registry.path)

    registry.sub_apikey = subkey
Esempio n. 11
0
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "hq", ["help", "quiet"])
    except getopt.GetoptError, e:
        usage(e)

    verbose = True
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

        if opt in ('-q', '--quiet'):
            verbose = False

    if args:
        usage()

    if not registry.sub_apikey and registry.fqdn:
        fatal("not initialized")

    try:
        hubdns = HubDNS(subkey=registry.sub_apikey)
        ipaddress = hubdns.update(registry.fqdn)
    except HubDNS.Error, e:
        fatal(e.description)

    if verbose:
        print "Updated %s with %s" % (registry.fqdn, ipaddress)

if __name__=="__main__":
    main()