2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Fix handling of explicit prefix

Switch to just ip in time and return prefix
length as int.
This commit is contained in:
Jarrod Johnson 2022-07-21 11:06:01 -04:00
parent d385ad1a0a
commit d61dcee4fa

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2017 Lenovo
# Copyright 2017,2022 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -527,6 +527,7 @@ def get_nic_config(configmanager, node, ip=None, mac=None, ifidx=None,
if ip is not None:
for prefixinfo in get_prefix_len_for_ip(ip):
fam, prefix = prefixinfo
ip = ip.split('/', 1)[0]
if fam == socket.AF_INET:
cfgdata['prefix'] = prefix
nver = '4'
@ -609,6 +610,7 @@ def get_prefix_len_for_ip(ip):
plen = None
if '/' in ip:
ip, plen = ip.split('/', 1)
plen = int(plen)
myaddrs = get_my_addresses()
found = False
for inf in socket.getaddrinfo(ip, 0, 0, socket.SOCK_DGRAM):