mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-26 19:10:30 +00:00
Improve error handling in pxe
If a name resolution error happens, put an event in events for the cleaner error.
This commit is contained in:
parent
d5ff9b4cb5
commit
55ee203974
@ -475,6 +475,9 @@ def check_reply(node, info, packet, sock, cfg, reqview):
|
||||
gateway = None
|
||||
netmask = None
|
||||
niccfg = netutil.get_nic_config(cfg, node, ifidx=info['netinfo']['ifidx'])
|
||||
nicerr = niccfg.get('error_msg', False)
|
||||
if nicerr:
|
||||
log.log({'error': nicerr})
|
||||
if niccfg.get('ipv4_broken', False):
|
||||
# Received a request over a nic with no ipv4 configured, ignore it
|
||||
return
|
||||
|
@ -202,13 +202,16 @@ def get_nic_config(configmanager, node, ip=None, mac=None, ifidx=None,
|
||||
continue
|
||||
candgw = cfgbyname[candidate].get('ipv4_gateway', None)
|
||||
if candip:
|
||||
if ip_on_same_subnet(net, candip, prefix):
|
||||
cfgdata['ipv4_address'] = candip
|
||||
cfgdata['ipv4_method'] = 'static'
|
||||
cfgdata['ipv4_gateway'] = cfgbyname[candidate].get(
|
||||
'ipv4_gateway', None)
|
||||
cfgdata['prefix'] = prefix
|
||||
return cfgdata
|
||||
try:
|
||||
if ip_on_same_subnet(net, candip, prefix):
|
||||
cfgdata['ipv4_address'] = candip
|
||||
cfgdata['ipv4_method'] = 'static'
|
||||
cfgdata['ipv4_gateway'] = cfgbyname[candidate].get(
|
||||
'ipv4_gateway', None)
|
||||
cfgdata['prefix'] = prefix
|
||||
return cfgdata
|
||||
except Exception as e:
|
||||
cfgdata['error_msg'] = 'Error trying to evaluate "{0}" for {1}: {2}'.format(candip, node, str(e))
|
||||
elif candgw:
|
||||
if ip_on_same_subnet(net, candgw, prefix):
|
||||
candgws.append(candgw)
|
||||
|
Loading…
x
Reference in New Issue
Block a user