Changeset 10461 in genesis for tools


Ignore:
Timestamp:
Apr 12, 2012, 9:27:12 PM (13 years ago)
Author:
rick
Message:

Make sure Hybrid fall under totally new category and include items in proxies
lists for example. Also allow DNS entry to be 'core'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10460 r10461  
    8181  gfile = os.path.join(NODE_DIR,item,'wleiden.yaml')
    8282
     83  # Use some boring defaults
     84  datadump = { 'service_proxy' : False, 'service_ileiden' : False }
    8385  f = open(gfile, 'r')
    84   datadump = yaml.load(f,Loader=Loader)
     86  datadump.update(yaml.load(f,Loader=Loader))
    8587  f.close()
    8688
     
    151153
    152154def get_hybridlist():
    153   """Get all available proxies hybridX sorting based on X number"""
    154   hybridlist = sorted([os.path.basename(x) for x in glob.glob("%s/hybrid*" % NODE_DIR)],
    155                 key=lambda name: int(''.join([c for c in name if c in string.digits])),
    156                 cmp=lambda x,y: x - y)
     155  """Get all available hybrid nodes/proxies"""
     156  hybridlist = sorted([os.path.basename(x) for x in glob.glob("%s/Hybrid*" % NODE_DIR)])
    157157  return hybridlist
    158158
     
    446446    else:
    447447      normal_proxies.append(proxydump)
     448  for host in get_hybridlist():
     449    hostdump = get_yaml(host)
     450    if hostdump['service_ileiden']:
     451      ileiden_proxies.append(hostdump)
     452    if hostdump['service_proxy']:
     453      normal_proxies.append(hostdump)
     454
    448455  datadump['autogen_ileiden_proxies'] = ','.join([x['masterip'] for x in ileiden_proxies])
    449456  datadump['autogen_ileiden_proxies_names'] = ','.join([x['autogen_item'] for x in ileiden_proxies])
     
    877884    # Proxy naming convention is special
    878885    fqdn = datadump['autogen_realname']
    879     if datadump['nodetype'] == 'CNode':
     886    if datadump['nodetype'] in ['CNode', 'Hybrid']:
    880887      wleiden_cname[datadump['nodename']] = fqdn
    881888
     
    897904        # First push it into a pool, to indentify the counter-part later on
    898905        addr = parseaddr(ip)
    899         netmask = int(netmask)
    900         addr = addr & ~((1 << (32 - netmask)) - 1)
     906        cidr = int(cidr)
     907        addr = addr & ~((1 << (32 - cidr)) - 1)
    901908        if pool.has_key(addr):
    902909          pool[addr] += [(iface_name, fqdn, ip)]
Note: See TracChangeset for help on using the changeset viewer.