From 1472528f6db9fe70a6931f243dafb87105767902 Mon Sep 17 00:00:00 2001
From: David Louks <2402775+dlouks@users.noreply.github.com>
Date: Mon, 27 Sep 2021 13:04:20 -0500
Subject: [PATCH] check if 'plugins' key exists in calico_cni_config object
 (#7717)

* check if 'plugins' key exists in calico_cni_config object

* fix whitespace linting error

* fixed when list indentation
---
 roles/network_plugin/calico/tasks/pre.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/roles/network_plugin/calico/tasks/pre.yml b/roles/network_plugin/calico/tasks/pre.yml
index e274808b6..74d3f7915 100644
--- a/roles/network_plugin/calico/tasks/pre.yml
+++ b/roles/network_plugin/calico/tasks/pre.yml
@@ -12,7 +12,9 @@
   - name: Set fact calico_datastore to etcd if needed
     set_fact:
       calico_datastore: etcd
-    when: "'etcd_endpoints' in calico_cni_config.plugins.0"
+    when:
+    - "'plugins' in calico_cni_config"
+    - "'etcd_endpoints' in calico_cni_config.plugins.0"
   when: calico_cni_config_slurp.content is defined
 
 - name: Calico | Get kubelet hostname
-- 
GitLab