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))
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))
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)
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)
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()
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