From 29995105c0143505a51b3c1102a3eadc60b46318 Mon Sep 17 00:00:00 2001
From: Rodolfo Carvalho <rhcarvalho@gmail.com>
Date: Mon, 12 Jun 2017 11:49:02 +0200
Subject: Fix possible access to undefined variable

g_glusterfs_hosts is verified to be defined in the beginning of the
playbook.
g_glusterfs_registry_hosts is only defined when
playbooks/byo/openshift-cluster/cluster_hosts.yml is loaded, which seems
to not always be the case.

Instead of trying to find all entrypoints where cluster_hosts should be
loaded to defined the variable, simply use the `default()` filter to
consider it empty when not defined.
---
 playbooks/common/openshift-cluster/evaluate_groups.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'playbooks/common')

diff --git a/playbooks/common/openshift-cluster/evaluate_groups.yml b/playbooks/common/openshift-cluster/evaluate_groups.yml
index 46932b27f..c28ce4c14 100644
--- a/playbooks/common/openshift-cluster/evaluate_groups.yml
+++ b/playbooks/common/openshift-cluster/evaluate_groups.yml
@@ -155,5 +155,5 @@
       groups: oo_glusterfs_to_config
       ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
       ansible_become: "{{ g_sudo | default(omit) }}"
-    with_items: "{{ g_glusterfs_hosts | union(g_glusterfs_registry_hosts) | default([]) }}"
+    with_items: "{{ g_glusterfs_hosts | union(g_glusterfs_registry_hosts | default([])) }}"
     changed_when: no
-- 
cgit v1.2.3