summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2017-03-15 14:52:27 -0400
committerAndrew Butcher <abutcher@redhat.com>2017-03-16 10:40:17 -0400
commit7fbc356ec6896e441f2423bd3168ff231b4a8bb2 (patch)
tree066802602ec152732e73e353bc41eda9a4974615
parente69804c0d37329c2bf8c9c2c2c48930e34852217 (diff)
downloadopenshift-7fbc356ec6896e441f2423bd3168ff231b4a8bb2.tar.gz
openshift-7fbc356ec6896e441f2423bd3168ff231b4a8bb2.tar.bz2
openshift-7fbc356ec6896e441f2423bd3168ff231b4a8bb2.tar.xz
openshift-7fbc356ec6896e441f2423bd3168ff231b4a8bb2.zip
Fix get_router_replicas infrastructure node count.
-rw-r--r--roles/openshift_hosted/filter_plugins/filters.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/roles/openshift_hosted/filter_plugins/filters.py b/roles/openshift_hosted/filter_plugins/filters.py
index cbfadfe9d..7f41529ac 100644
--- a/roles/openshift_hosted/filter_plugins/filters.py
+++ b/roles/openshift_hosted/filter_plugins/filters.py
@@ -21,14 +21,21 @@ class FilterModule(object):
if replicas is not None:
return replicas
+ replicas = 1
+
+ # Ignore boolean expression limit of 5.
+ # pylint: disable=too-many-boolean-expressions
if (isinstance(router_nodes, dict) and
'results' in router_nodes and
'results' in router_nodes['results'] and
- 'items' in router_nodes['results']['results']):
+ isinstance(router_nodes['results']['results'], list) and
+ len(router_nodes['results']['results']) > 0 and
+ 'items' in router_nodes['results']['results'][0]):
- return len(router_nodes['results']['results'][0]['items'])
+ if len(router_nodes['results']['results'][0]['items']) > 0:
+ replicas = len(router_nodes['results']['results'][0]['items'])
- return 1
+ return replicas
def filters(self):
''' returns a mapping of filters to methods '''