From 79fa6fbe1cd73c55a2b56dcb81ace2c2c01ce75b Mon Sep 17 00:00:00 2001 From: John Fulton Date: Wed, 5 Jan 2022 22:11:21 +0000 Subject: [PATCH] Handle missing ipv6 boolean in network_data.yaml for Ceph It's not valid input to exclude the ipv6 boolean when using IPv6, but when this happens the client fails with a type error. Handle this situation better and return a better error message. Closes-Bug: 1956517 Change-Id: Id99346ac0fc336b306550e71da0f9b746ff83ef1 --- tripleoclient/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index 0fe80bbfb..e02987119 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -3246,7 +3246,7 @@ def get_ceph_networks(network_data_path, if ip_subnet in net: return net[ip_subnet] if 'subnets' in net: - ip_subnets = list(map(lambda x: x.get(ip_subnet), + ip_subnets = list(map(lambda x: x.get(ip_subnet, ''), net['subnets'].values())) return ','.join(ip_subnets) @@ -3274,9 +3274,11 @@ def get_ceph_networks(network_data_path, if not subnet: error = ("While searching %s, %s matched %s " "but that network did not have a %s " - "value set." + "value set. To use an ipv6_subnet add " + "key 'ipv6: true' to %s in %s." % (network_data_path, search_tag, - net_value, ip_subnet)) + net_value, ip_subnet, net_value, + network_data_path)) raise RuntimeError(error) else: subnet_key = net_name.replace('_name', '')