- Timestamp:
- Aug 9, 2011, 3:28:18 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r9286 r9514 750 750 f.write(generate_config(node, config, datadump)) 751 751 f.close() 752 elif sys.argv[1] == "wind-export": 753 items = dict() 754 for node in get_hostlist(): 755 datadump = get_yaml(node) 756 sql = """INSERT IGNORE INTO nodes (name, name_ns, longitude, latitude) 757 VALUES ('%(nodename)s', '%(nodename)s', %(latitude)s, %(longitude)s);""" % datadump; 758 print sql 759 sql = """INSERT IGNORE INTO users_nodes (user_id, node_id, owner) 760 VALUES ( 761 (SELECT id FROM users WHERE username = 'rvdzwet'), 762 (SELECT id FROM nodes WHERE name = '%(nodename)s'), 763 'Y');""" % datadump 764 print sql 765 #for config in files: 766 # items['config'] = config 767 # print "## Generating %(node)s %(config)s" % items 768 # f = open("%(wdir)s/%(config)s" % items, "w") 769 # f.write(generate_config(node, config, datadump)) 770 # f.close() 771 for node in get_hostlist(): 772 datadump = get_yaml(node) 773 for iface_key in sorted([elem for elem in datadump.keys() if elem.startswith('iface_')]): 774 ifacedump = datadump[iface_key] 775 if ifacedump.has_key('mode') and ifacedump['mode'] == 'ap-wds': 776 ifacedump['nodename'] = datadump['nodename'] 777 if not ifacedump.has_key('channel') or not ifacedump['channel']: 778 ifacedump['channel'] = 0 779 sql = """INSERT INTO links (node_id, type, ssid, protocol, channel, status) 780 VALUES ((SELECT id FROM nodes WHERE name = '%(nodename)s'), 'ap', 781 '%(ssid)s', 'IEEE 802.11b', %(channel)s, 'active');""" % ifacedump 782 print sql 752 783 elif sys.argv[1] == "dns": 753 784 make_dns(sys.argv[2] if len(sys.argv) > 2 else 'dns')
Note:
See TracChangeset
for help on using the changeset viewer.