From 952c57645e7f081125d961759cf108dbca59259f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 6 Mar 2018 09:13:39 -0500 Subject: [PATCH] TT#24841 don't return empty strings from IP helper scripts Change-Id: Ic604bae6d83853746067e8440467ced6e6cefe31 --- lib/get_all_adv_ips | 1 + lib/get_all_adv_ips_for_host | 1 + lib/get_all_cluster_set_ip_maps | 1 + lib/get_all_cluster_set_ip_maps_for_host | 1 + lib/get_all_cluster_set_shared_ip_maps | 1 + lib/get_all_cluster_set_shared_ip_maps_for_host | 1 + lib/get_all_hosts_ips | 1 + lib/get_all_ips | 1 + lib/get_all_ips_for_host | 1 + lib/get_all_shared_ips | 1 + lib/get_all_shared_ips_for_host | 1 + lib/get_all_shared_v6ips | 1 + lib/get_all_shared_v6ips_for_host | 1 + lib/get_all_v6ips | 1 + 14 files changed, 14 insertions(+) diff --git a/lib/get_all_adv_ips b/lib/get_all_adv_ips index a944a13a..9f805c0b 100644 --- a/lib/get_all_adv_ips +++ b/lib/get_all_adv_ips @@ -41,6 +41,7 @@ FOREACH host IN hosts.keys.sort; peer = hosts.$host.peer; blktmp.processed_hosts.$peer = 1; FOREACH ip IN hosts.$host.$realiface.advertised_ip; + NEXT UNLESS ip; out.push(ip); END; END; diff --git a/lib/get_all_adv_ips_for_host b/lib/get_all_adv_ips_for_host index 092fecf3..92544f4a 100644 --- a/lib/get_all_adv_ips_for_host +++ b/lib/get_all_adv_ips_for_host @@ -38,6 +38,7 @@ IF status.item(hosts.${argv.host}.status); NEXT UNLESS hosts.${argv.host}.$realiface.type.grep('^' _ argv.type _ '$').size(); FOREACH ip IN hosts.${argv.host}.$realiface.advertised_ip; + NEXT UNLESS ip; out.push(ip); END; END; diff --git a/lib/get_all_cluster_set_ip_maps b/lib/get_all_cluster_set_ip_maps index 087881e5..2da22970 100644 --- a/lib/get_all_cluster_set_ip_maps +++ b/lib/get_all_cluster_set_ip_maps @@ -35,6 +35,7 @@ FOREACH set IN cluster_sets.keys; FOREACH iface IN hosts.$host.interfaces; NEXT UNLESS hosts.$host.$iface.cluster_sets.grep('^' _ set _ '$').size(); NEXT UNLESS hosts.$host.$iface.type.grep('^' _ argv.type _ '$').size(); + NEXT UNLESS hosts.$host.$iface.ip; theset.ips.push(hosts.$host.$iface.ip) UNLESS theset.ips.defined(hosts.$host.$iface.ip); END; END; diff --git a/lib/get_all_cluster_set_ip_maps_for_host b/lib/get_all_cluster_set_ip_maps_for_host index c5051bb4..3d980667 100644 --- a/lib/get_all_cluster_set_ip_maps_for_host +++ b/lib/get_all_cluster_set_ip_maps_for_host @@ -48,6 +48,7 @@ FOREACH set IN cluster_sets.keys; FOREACH iface IN hosts.$host.interfaces; NEXT UNLESS hosts.$host.$iface.cluster_sets.grep('^' _ set _ '$').size(); NEXT UNLESS hosts.$host.$iface.type.grep('^' _ argv.type _ '$').size(); + NEXT UNLESS hosts.$host.$iface.ip; theset.ips.push(hosts.$host.$iface.ip) UNLESS theset.ips.defined(hosts.$host.$iface.ip); END; END; diff --git a/lib/get_all_cluster_set_shared_ip_maps b/lib/get_all_cluster_set_shared_ip_maps index 3d65a9e1..78ddd76f 100644 --- a/lib/get_all_cluster_set_shared_ip_maps +++ b/lib/get_all_cluster_set_shared_ip_maps @@ -41,6 +41,7 @@ FOREACH set IN cluster_sets.keys; NEXT UNLESS hosts.$host.$iface.type.grep('^' _ argv.type _ '$').size(); blktmp.processed_hosts.$peer = 1; FOREACH ip IN hosts.$host.$iface.shared_ip; + NEXT UNLESS ip; theset.ips.push(ip) UNLESS theset.ips.defined(ip); END; END; diff --git a/lib/get_all_cluster_set_shared_ip_maps_for_host b/lib/get_all_cluster_set_shared_ip_maps_for_host index 3f32c8bc..45185fac 100644 --- a/lib/get_all_cluster_set_shared_ip_maps_for_host +++ b/lib/get_all_cluster_set_shared_ip_maps_for_host @@ -53,6 +53,7 @@ FOREACH set IN cluster_sets.keys; NEXT UNLESS hosts.$host.$iface.type.grep('^' _ argv.type _ '$').size(); blktmp.processed_hosts.$peer = 1; FOREACH ip IN hosts.$host.$iface.shared_ip; + NEXT UNLESS ip; theset.ips.push(ip) UNLESS theset.ips.defined(ip); END; END; diff --git a/lib/get_all_hosts_ips b/lib/get_all_hosts_ips index 5a2dcb5e..769a35f2 100644 --- a/lib/get_all_hosts_ips +++ b/lib/get_all_hosts_ips @@ -39,6 +39,7 @@ FOREACH host IN hosts.keys.sort; NEXT IF realiface != iface; NEXT UNLESS hosts.$host.$realiface.type.grep('^' _ argv.type _ '$').size(); NEXT IF out.grep('^' _ hosts.$host.$realiface.ip _ '$').size(); + NEXT UNLESS hosts.$host.$realiface.ip; out.push({ name = host, ip = hosts.$host.$realiface.ip }); END; diff --git a/lib/get_all_ips b/lib/get_all_ips index 01fb81e9..41545bf1 100644 --- a/lib/get_all_ips +++ b/lib/get_all_ips @@ -36,6 +36,7 @@ FOREACH host IN hosts.keys; NEXT IF realiface != iface; NEXT UNLESS hosts.$host.$realiface.type.grep('^' _ argv.type _ '$').size(); NEXT IF out.grep('^' _ hosts.$host.$realiface.ip _ '$').size(); + NEXT UNLESS hosts.$host.$realiface.ip; out.push(hosts.$host.$realiface.ip); END; diff --git a/lib/get_all_ips_for_host b/lib/get_all_ips_for_host index 17ae5b24..a165f132 100644 --- a/lib/get_all_ips_for_host +++ b/lib/get_all_ips_for_host @@ -36,6 +36,7 @@ IF status.item(hosts.${argv.host}.status); FOREACH realiface IN hosts.${argv.host}.keys; NEXT IF realiface != iface; NEXT UNLESS hosts.${argv.host}.$realiface.type.grep('^' _ argv.type _ '$').size(); + NEXT UNLESS hosts.${argv.host}.$realiface.ip; out.push(hosts.${argv.host}.$realiface.ip); END; diff --git a/lib/get_all_shared_ips b/lib/get_all_shared_ips index 215d5437..f5a16430 100644 --- a/lib/get_all_shared_ips +++ b/lib/get_all_shared_ips @@ -41,6 +41,7 @@ FOREACH host IN hosts.keys.sort; peer = hosts.$host.peer; blktmp.processed_hosts.$peer = 1; FOREACH ip IN hosts.$host.$realiface.shared_ip; + NEXT UNLESS ip; out.push(ip); END; END; diff --git a/lib/get_all_shared_ips_for_host b/lib/get_all_shared_ips_for_host index 00c266dc..973a8590 100644 --- a/lib/get_all_shared_ips_for_host +++ b/lib/get_all_shared_ips_for_host @@ -38,6 +38,7 @@ IF status.item(hosts.${argv.host}.status); NEXT UNLESS hosts.${argv.host}.$realiface.type.grep('^' _ argv.type _ '$').size(); FOREACH ip IN hosts.${argv.host}.$realiface.shared_ip; + NEXT UNLESS ip; out.push(ip); END; END; diff --git a/lib/get_all_shared_v6ips b/lib/get_all_shared_v6ips index 6b6625f0..17545cc1 100644 --- a/lib/get_all_shared_v6ips +++ b/lib/get_all_shared_v6ips @@ -50,6 +50,7 @@ FOREACH host IN hosts.keys.sort; ip = ip.replace('^:', '0:'); ip = ip.replace(':$', ':0'); END; + NEXT UNLESS ip; out.push(ip); END; END; diff --git a/lib/get_all_shared_v6ips_for_host b/lib/get_all_shared_v6ips_for_host index 411b9d2b..0813993d 100644 --- a/lib/get_all_shared_v6ips_for_host +++ b/lib/get_all_shared_v6ips_for_host @@ -47,6 +47,7 @@ IF status.item(hosts.${argv.host}.status); ip = ip.replace('^:', '0:'); ip = ip.replace(':$', ':0'); END; + NEXT UNLESS ip; out.push(ip); END; END; diff --git a/lib/get_all_v6ips b/lib/get_all_v6ips index 71a7e7f6..1c0ca42a 100644 --- a/lib/get_all_v6ips +++ b/lib/get_all_v6ips @@ -35,6 +35,7 @@ FOREACH host IN hosts.keys.sort; FOREACH realiface IN hosts.$host.keys; NEXT IF realiface != iface; NEXT UNLESS hosts.$host.$realiface.type.grep('^' _ argv.type _ '$').size(); + NEXT UNLESS hosts.$host.$realiface.v6ip; out.push(hosts.$host.$realiface.v6ip); END;