- Timestamp:
- May 2, 2012, 11:06:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10655 r10656 1021 1021 1022 1022 1023 def pool_to_name( node, pool_members):1023 def pool_to_name(fqdn, pool_members): 1024 1024 """Convert the joined name to a usable pool name""" 1025 1025 1026 # Get rid of the own entry 1027 pool_members = list(set(pool_members) - set([fqdn])) 1028 1029 target = oldname = '' 1026 def isplit(item): 1027 (prefix, name, number) = re.match('^(cnode|hybrid|proxy)([a-z]+)([0-9]*)$',item.lower()).group(1,2,3) 1028 return (prefix, name, number) 1029 1030 my_name = isplit(fqdn.split('.')[0])[1] 1031 1032 short_names = defaultdict(list) 1030 1033 for node in sorted(pool_members): 1031 (name, number) = re.match('^([A-Za-z]+)([0-9]*)$',node).group(1,2) 1032 target += "-" + number if name == oldname else "-" + node if target else node 1033 oldname = name 1034 1035 return target 1034 (prefix, name, number) = isplit(node) 1035 short_names[name].append((prefix,number)) 1036 1037 return '-'.join(sorted(short_names.keys())) 1036 1038 1037 1039 … … 1074 1076 for item in value: 1075 1077 (iface_name, fqdn, ip) = item 1076 pool_name = "2pool-" + showaddr(key).replace('.','-') + "-" +pool_to_name(fqdn,pool_members)1078 pool_name = "2pool-" + pool_to_name(fqdn,pool_members) 1077 1079 wleiden_zone["%s.%s" % (pool_name, fqdn)].append((ip, True)) 1078 1080
Note:
See TracChangeset
for help on using the changeset viewer.