Changeset 12574 in genesis
- Timestamp:
- Dec 17, 2013, 8:12:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/syntax-checker.py
r12291 r12574 7 7 import sys 8 8 9 from collections import defaultdict 10 9 11 __version__ = '$Id$' 10 12 … … 12 14 13 15 def check_double_ip(): 14 pool = {}16 pool = defaultdict(list) 15 17 try: 16 18 for host in gformat.get_hostlist(): 17 print "## Processing host %-2 0s: " % host,19 print "## Processing host %-25s: " % host, 18 20 datadump = gformat.get_yaml(host,add_version_info=False) 19 21 try: 22 # Process interfaces 20 23 iface_keys = [elem for elem in datadump.keys() if (elem.startswith('iface_') and not "lo0" in elem)] 21 24 for iface_key in iface_keys: … … 23 26 addr, mask = l.split('/') 24 27 25 label = "%s - %s" % (host, iface_key) 26 if pool.has_key(addr): 27 pool[addr] += [label] 28 else: 29 pool[addr] = [label] 28 pool[addr].append((host, iface_key)) 29 30 iface_key = 'masterip' 31 addr = datadump['masterip'] 32 # Add masterip to the list if IP has not been defined at interface 33 if not host in [x[0] for x in pool[addr]]: 34 pool[addr].append((host, 'masterip')) 35 30 36 print "OK" 31 37 except (KeyError, ValueError), e: 32 print "[ERROR] in '%s' interface '%s' (%s)" % (host, iface_key, e)38 print "[ERROR] in '%s' interface '%s' (%s)" % (host, iface_key, e) 33 39 raise 34 40 except Exception as e: … … 41 47 if not any(map(lambda x: addr.startswith(x), allowed_multi_use)): 42 48 print "[ERROR] Multiple usages of IP %s:" % (addr) 43 print " -", "\n - ".join(leden) 49 for host, key in leden: 50 print " - %s - %s" % (host, key) 44 51 error = True 45 52
Note:
See TracChangeset
for help on using the changeset viewer.