Add TypeError exception when parsing addresses

When parsing addresses the value could be None, if that is the case, we
need to handle the result and return it accordingly. This change adds
the expected TypeError when dealing with a null value.

Additionally the overcloudrc will now process the data ahead of time and
ensure that the items in the array have an assosiated value before
feeding the data into the mapped function.

Change-Id: I5a1900d4e50395065b6b56876ab9ee10f01fae05
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2021-06-16 12:56:48 -05:00
parent 1fa0990327
commit eaeb230f83
No known key found for this signature in database
GPG Key ID: 5045BC941175BDF5
2 changed files with 6 additions and 3 deletions

View File

@ -23,5 +23,5 @@ def bracket_ipv6(address):
try:
socket.inet_pton(socket.AF_INET6, address)
return "[%s]" % address
except socket.error:
except (socket.error, TypeError):
return address

View File

@ -80,8 +80,11 @@ def _create_overcloudrc(stack, no_proxy, admin_password, region_name):
overcloud_admin_vip = get_endpoint('KeystoneAdmin', stack)
no_proxy_list = no_proxy.split(',')
no_proxy_list = map(common_utils.bracket_ipv6,
no_proxy_list + [overcloud_host, overcloud_admin_vip])
no_proxy_list.extend([overcloud_host, overcloud_admin_vip])
no_proxy_list = map(
common_utils.bracket_ipv6,
[i for i in no_proxy_list if i]
)
# Remove duplicated entries
no_proxy_list = sorted(list(set(no_proxy_list)))