mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 19:10:10 +00:00
Avoid calling implicit nic config if nowhere to put it
If 'None' attributes are in use, we'd have no where to stick implicit configuration anyway.
This commit is contained in:
parent
8ca1f80ef6
commit
691d92f735
@ -332,18 +332,7 @@ def get_full_net_config(configmanager, node, serverip=None):
|
||||
if serverip:
|
||||
myaddrs = get_addresses_by_serverip(serverip)
|
||||
nm = NetManager(myaddrs, node, configmanager)
|
||||
nnc = get_nic_config(configmanager, node, serverip=serverip)
|
||||
defaultnic = {}
|
||||
if nnc.get('ipv4_address', None):
|
||||
defaultnic['ipv4_address'] = '{}/{}'.format(nnc['ipv4_address'], nnc['prefix'])
|
||||
if nnc.get('ipv4_gateway', None):
|
||||
defaultnic['ipv4_gateway'] = nnc['ipv4_gateway']
|
||||
if nnc.get('ipv4_method', None):
|
||||
defaultnic['ipv4_method'] = nnc['ipv4_method']
|
||||
if nnc.get('ipv6_address', None):
|
||||
defaultnic['ipv6_address'] = '{}/{}'.format(nnc['ipv6_address'], nnc['ipv6_prefix'])
|
||||
if nnc.get('ipv6_method', None):
|
||||
defaultnic['ipv6_method'] = nnc['ipv6_method']
|
||||
if None in attribs:
|
||||
nm.process_attribs(None, attribs[None])
|
||||
del attribs[None]
|
||||
@ -354,6 +343,18 @@ def get_full_net_config(configmanager, node, serverip=None):
|
||||
retattrs['default'] = nm.myattribs[None]
|
||||
add_netmask(retattrs['default'])
|
||||
del nm.myattribs[None]
|
||||
else:
|
||||
nnc = get_nic_config(configmanager, node, serverip=serverip)
|
||||
if nnc.get('ipv4_address', None):
|
||||
defaultnic['ipv4_address'] = '{}/{}'.format(nnc['ipv4_address'], nnc['prefix'])
|
||||
if nnc.get('ipv4_gateway', None):
|
||||
defaultnic['ipv4_gateway'] = nnc['ipv4_gateway']
|
||||
if nnc.get('ipv4_method', None):
|
||||
defaultnic['ipv4_method'] = nnc['ipv4_method']
|
||||
if nnc.get('ipv6_address', None):
|
||||
defaultnic['ipv6_address'] = '{}/{}'.format(nnc['ipv6_address'], nnc['ipv6_prefix'])
|
||||
if nnc.get('ipv6_method', None):
|
||||
defaultnic['ipv6_method'] = nnc['ipv6_method']
|
||||
retattrs['extranets'] = nm.myattribs
|
||||
for attri in retattrs['extranets']:
|
||||
add_netmask(retattrs['extranets'][attri])
|
||||
@ -361,7 +362,7 @@ def get_full_net_config(configmanager, node, serverip=None):
|
||||
defaultnic = {}
|
||||
if retattrs['extranets'][attri].get('ipv6_address', None) == defaultnic.get('ipv6_address', 'NOPE'):
|
||||
defaultnic = {}
|
||||
if 'default' not in retattrs and defaultnic:
|
||||
if defaultnic:
|
||||
retattrs['default'] = defaultnic
|
||||
add_netmask(retattrs['default'])
|
||||
ipv4addr = defaultnic.get('ipv4_address', None)
|
||||
|
Loading…
Reference in New Issue
Block a user