Changeset 10887 in genesis for tools/gformat.py
- Timestamp:
- May 16, 2012, 9:32:05 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10885 r10887 97 97 datadump_cache = {} 98 98 99 NO_DHCP = 0 100 DHCP_CLIENT = 10 101 DHCP_SERVER = 20 102 def dhcp_type(item): 103 if not item.has_key('dhcp'): 104 return NO_DHCP 105 elif not item['dhcp']: 106 return NO_DHCP 107 elif item['dhcp'].lower() == 'client': 108 return DHCP_CLIENT 109 else: 110 return DHCP_SERVER 111 99 112 def get_yaml(item): 100 113 try: … … 139 152 raise 140 153 141 dhcp_interfaces = [datadump[key]['autogen_ifname'] for key in datadump['autogen_iface_keys'] if (datadump[key].has_key('dhcp') and datadump[key]['dhcp'])] 154 dhcp_interfaces = [datadump[key]['autogen_ifname'] for key in datadump['autogen_iface_keys'] \ 155 if dhcp_type(datadump[key]) == DHCP_SERVER] 156 142 157 datadump['autogen_dhcp_interfaces'] = dhcp_interfaces 143 158 datadump['autogen_item'] = item … … 433 448 datadump[iface_key]['autogen_subnet'] = get_network(addr, mask) 434 449 try: 450 if dhcp_type(datadump[iface_key]) != DHCP_SERVER: 451 raise ValueError 435 452 (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-') 436 453 except (AttributeError, ValueError, KeyError): … … 678 695 679 696 # Flag dhclient is possible 680 dhclient_if[ifname] = ifacedump.has_key('dhcpclient') and ifacedump['dhcpclient']697 dhclient_if[ifname] = dhcp_type(ifacedump) == DHCP_CLIENT 681 698 682 699 # Add interface IP to list … … 948 965 ('ssid', False), 949 966 ('dhcp', True), 950 ('dhcpclient', False),951 967 ('compass', False), 952 968 ('distance', False),
Note:
See TracChangeset
for help on using the changeset viewer.