From e3e55706609b40ddf25e7ce4fcc6d9c5936b55ed Mon Sep 17 00:00:00 2001 From: OpenShift Merge Robot Date: Sep 29 2020 00:00:03 +0000 Subject: Merge pull request #12233 from syedriko/bz_1848454 Bug 1848454: OpenShift logging upgrade from 3.11.161 to 3.11.219 fails --- diff --git a/roles/openshift_logging/tasks/install_logging.yaml b/roles/openshift_logging/tasks/install_logging.yaml index 0d557cb..f39c15b 100644 --- a/roles/openshift_logging/tasks/install_logging.yaml +++ b/roles/openshift_logging/tasks/install_logging.yaml @@ -65,7 +65,8 @@ with_sequence: count={{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count }} when: openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count > 0 -- set_fact: es_indices=[] +- set_fact: + es_indices: [] when: openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count == 0 - set_fact: openshift_logging_es_pvc_prefix="logging-es" @@ -82,6 +83,13 @@ - set_fact: default_elasticsearch_storage_type: "{{ 'pvc' if ( openshift_logging_es_pvc_dynamic | bool or openshift_logging_storage_kind | default('') == 'nfs' or openshift_logging_es_pvc_size | length > 0) else 'emptydir' }}" +# Pre-condition check for the following include_role, to make sure the lists in with_together are +# the same length and do not get padded with Nones +# +- fail: + msg: There must be the same number of ES DeploymentConfigs, ES PVCs and ES indices. Found ES DeploymentConfigs - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() }}", ES DC count - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count }}", ES PVCs - "{{ openshift_logging_facts.elasticsearch.pvcs }}", ES PVC length - "{{ openshift_logging_facts.elasticsearch.pvcs | length }}" and ES indices - "{{ es_indices }}", ES indices length - "{{ es_indices | length }}" + when: (openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count != openshift_logging_facts.elasticsearch.pvcs | length) or (openshift_logging_facts.elasticsearch.pvcs | length != es_indices | length) or (openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count != es_indices | length) + - include_role: name: openshift_logging_elasticsearch vars: @@ -145,7 +153,8 @@ - openshift_logging_use_ops | bool - openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count > 0 -- set_fact: es_ops_indices=[] +- set_fact: + es_ops_indices: [] when: openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count == 0 - set_fact: openshift_logging_es_ops_pvc_prefix="logging-es-ops" @@ -156,6 +165,15 @@ when: - openshift_logging_use_ops | bool +# Pre-condition check for the following include_role, to make sure the lists in with_together are +# the same length and do not get padded with Nones +# +- fail: + msg: There must be the same number of ES DeploymentConfigs, ES PVCs and ES Ops indices. Found ES DeploymentConfigs - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() }}", ES PVCs - "{{ openshift_logging_facts.elasticsearch.pvcs }}" and ES Ops indices - "{{ es_ops_indices }}" + when: + - (openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count != openshift_logging_facts.elasticsearch.pvcs | length) or (openshift_logging_facts.elasticsearch.pvcs | length != es_ops_indices | length) or (openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count != es_ops_indices | length) + - openshift_logging_use_ops | bool + - include_role: name: openshift_logging_elasticsearch vars: