- Timestamp:
- Nov 21, 2011, 6:46:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r9697 r9728 400 400 ip_list.append(addr) 401 401 else: 402 print "## IP '%s' in '%s' not valid" % (addr, config['nodename'])402 logger.error("## IP '%s' in '%s' not valid" % (addr, config['nodename'])) 403 403 return sorted(ip_list) 404 404 … … 730 730 return True 731 731 handler = MyCGIHTTPRequestHandler 732 SocketServer.allow_reuse_address = True 732 733 httpd = SocketServer.TCPServer(("", PORT), handler) 733 734 httpd.server_name = 'localhost' 734 735 httpd.server_port = PORT 735 736 736 print "serving at port", PORT737 logger.info("serving at port %s", PORT) 737 738 try: 738 739 httpd.serve_forever() 739 740 except KeyboardInterrupt: 740 741 httpd.shutdown() 742 logger.info("All done goodbye") 741 743 elif sys.argv[1] == "test": 742 744 os.environ['PATH_INFO'] = "/".join(sys.argv[2:]) … … 753 755 for config in files: 754 756 items['config'] = config 755 print "## Generating %(node)s %(config)s" % items757 logger.info("## Generating %(node)s %(config)s" % items) 756 758 f = open("%(wdir)s/%(config)s" % items, "w") 757 759 f.write(generate_config(node, config, datadump)) … … 763 765 sql = """INSERT IGNORE INTO nodes (name, name_ns, longitude, latitude) 764 766 VALUES ('%(nodename)s', '%(nodename)s', %(latitude)s, %(longitude)s);""" % datadump; 765 print sql766 767 sql = """INSERT IGNORE INTO users_nodes (user_id, node_id, owner) 767 768 VALUES ( … … 769 770 (SELECT id FROM nodes WHERE name = '%(nodename)s'), 770 771 'Y');""" % datadump 771 print sql772 772 #for config in files: 773 773 # items['config'] = config … … 787 787 VALUES ((SELECT id FROM nodes WHERE name = '%(nodename)s'), 'ap', 788 788 '%(ssid)s', 'IEEE 802.11b', %(channel)s, 'active');""" % ifacedump 789 print sql790 789 elif sys.argv[1] == "full-export": 791 790 hosts = {} … … 801 800 datadumps = dict() 802 801 for host in get_hostlist(): 803 print "# Processing: ", host802 logger.info("# Processing: %s", host) 804 803 datadump = get_yaml(host) 805 804 datadumps[get_fqdn(datadump)] = datadump
Note:
See TracChangeset
for help on using the changeset viewer.