Changeset 13843 in genesis for tools


Ignore:
Timestamp:
Apr 28, 2017, 1:36:55 PM (8 years ago)
Author:
rick
Message:

Fix generation & cleanup of config files

Location:
tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r13842 r13843  
    299299    try:
    300300      for iface_key in get_interface_keys(datadump):
     301        # Bridge members has no IP assigned
     302        if 'parent' in datadump[iface_key] and not 'ip' in datadump[iface_key]:
     303          continue
    301304        net_addr = network(datadump[iface_key]['ip'])
    302305        poel[net_addr] += [(host,datadump[iface_key].copy())]
    303     except (KeyError, ValueError), e:
    304       errors.append("[FOUT] in '%s' interface '%s' (%s)" % (host,iface_key, e))
     306    except (KeyError, ValueError) as e:
     307      errors.append("[FOUT] in '%s' interface '%s' (%s)" % (host,iface_key, type(e).__name__ + ': ' +  str(e)))
    305308      continue
    306309
     
    21312134
    21322135          if 'rdnap_x' in datadump and 'rdnap_y' in datadump:
    2133             datadump['latitude'], datadump['longitude'] = map(lambda x: "%.5f" % x, rd2etrs(datadump['rdnap_x'], datadump['rdnap_y']))
     2136            if not 'latitude' in datadump and not 'longitude' in datadump:
     2137              datadump['latitude'], datadump['longitude'] = map(lambda x: "%.5f" % x, rd2etrs(datadump['rdnap_x'], datadump['rdnap_y']))
    21342138          elif 'latitude' in  datadump and 'longitude' in datadump:
    2135             datadump['rdnap_x'], datadump['rdnap_y'] = etrs2rd(datadump['latitude'], datadump['longitude'])
     2139            if not 'rdnap_x' in datadump and not 'rdnap_y' in datadump:
     2140              datadump['rdnap_x'], datadump['rdnap_y'] = etrs2rd(datadump['latitude'], datadump['longitude'])
     2141          # TODO: Compare outcome of both coordinate systems and validate against each-other
    21362142
    21372143          if datadump['nodename'].startswith('Proxy'):
     
    22072213
    22082214              # Set the compass value based on the angle between the poels
    2209               if datadump[iface_key].has_key('ns_ip'):
     2215              if 'ns_ip' in datadump[iface_key] and 'ip' in datadump[iface_key] and not 'compass' in datadump[iface_key]:
    22102216                my_pool = poel[network(datadump[iface_key]['ip'])]
    22112217                remote_hosts = list(set([x[0] for x in my_pool]) - set([host]))
     
    22132219                  compass_target = remote_hosts[0]
    22142220                  datadump[iface_key]['compass'] = cd_between_hosts(host, compass_target, datadumps)
     2221              # TODO: Compass wanted and actual direction might differ
    22152222
    22162223              # Monitoring Group default
  • tools/yaml2nag.py

    r11555 r13843  
    2929define host{
    3030  use        %(use)s
    31   host_name  %(autogen_realname)s
    32   alias      %(autogen_realname)s
     31  host_name  %(autogen_fqdn)s
     32  alias      %(autogen_fqdn)s
    3333  address    %(masterip)s
    3434  hostgroups %(hostgroups)s
     
    7373        print_host(datadump, hostgroups)
    7474      else:
    75         print "# ERROR: nodetype %(nodetype)s for %(autogen_realname)s not defined" % datadump
     75        print "# ERROR: nodetype %(nodetype)s for %(autogen_fqdn)s not defined" % datadump
    7676
    7777
Note: See TracChangeset for help on using the changeset viewer.