Changeset 9286 in genesis
- Timestamp:
- Jun 23, 2011, 7:33:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r9285 r9286 8 8 import sys 9 9 import os 10 import re 10 11 sys.path.append(os.path.dirname(__file__)) 11 12 … … 591 592 continue 592 593 594 595 def pool_to_name(node, pool_members): 596 """Convert the joined name to a usable pool name""" 597 598 # Get rid of the own entry 599 pool_members = list(set(pool_members) - set([fqdn])) 600 601 target = oldname = '' 602 for node in sorted(pool_members): 603 (name, number) = re.match('^([A-Za-z]+)([0-9]*)$',node).group(1,2) 604 target += "-" + number if name == oldname else "-" + node if target else node 605 oldname = name 606 607 return target 608 609 593 610 # Automatic naming convention of interlinks namely 2 + remote.lower() 594 611 for (key,value) in pool.iteritems(): … … 605 622 for item in value: 606 623 (iface_name, fqdn, ip) = item 607 pool_name = "2pool-" + showaddr(key).replace('.','-') + "-" + "-".join(sorted(list(set(pool_members) - set([fqdn]))))624 pool_name = "2pool-" + showaddr(key).replace('.','-') + "-" + pool_to_name(fqdn,pool_members) 608 625 wleiden_zone["%s.%s" % (pool_name, fqdn)] = ip 609 626
Note:
See TracChangeset
for help on using the changeset viewer.