- Timestamp:
- Apr 28, 2017, 1:36:55 PM (8 years ago)
- Location:
- tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r13842 r13843 299 299 try: 300 300 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 301 304 net_addr = network(datadump[iface_key]['ip']) 302 305 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))) 305 308 continue 306 309 … … 2131 2134 2132 2135 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'])) 2134 2138 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 2136 2142 2137 2143 if datadump['nodename'].startswith('Proxy'): … … 2207 2213 2208 2214 # 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]: 2210 2216 my_pool = poel[network(datadump[iface_key]['ip'])] 2211 2217 remote_hosts = list(set([x[0] for x in my_pool]) - set([host])) … … 2213 2219 compass_target = remote_hosts[0] 2214 2220 datadump[iface_key]['compass'] = cd_between_hosts(host, compass_target, datadumps) 2221 # TODO: Compass wanted and actual direction might differ 2215 2222 2216 2223 # Monitoring Group default -
tools/yaml2nag.py
r11555 r13843 29 29 define host{ 30 30 use %(use)s 31 host_name %(autogen_ realname)s32 alias %(autogen_ realname)s31 host_name %(autogen_fqdn)s 32 alias %(autogen_fqdn)s 33 33 address %(masterip)s 34 34 hostgroups %(hostgroups)s … … 73 73 print_host(datadump, hostgroups) 74 74 else: 75 print "# ERROR: nodetype %(nodetype)s for %(autogen_ realname)s not defined" % datadump75 print "# ERROR: nodetype %(nodetype)s for %(autogen_fqdn)s not defined" % datadump 76 76 77 77
Note:
See TracChangeset
for help on using the changeset viewer.