From bba55faae8a53a9f2f4a898a2fe6dea9a71d4b76 Mon Sep 17 00:00:00 2001
From: Jorik Jonker <jorik@kippendief.biz>
Date: Tue, 26 Jan 2021 08:52:34 +0100
Subject: [PATCH] calico: fix NetworkManager check (#7169)

Previous check for presence of NM assumed "systemctl show
NetworkManager" would exit with a nonzero status code, which seems not
the case anymore with recent Flatcar Container Linux.

This new check also checks the activeness of network manager, as
`is-active` implies presence.

Signed-off-by Jorik Jonker <jorik@kippendief.biz>
---
 roles/network_plugin/calico/tasks/install.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/roles/network_plugin/calico/tasks/install.yml b/roles/network_plugin/calico/tasks/install.yml
index 7c8ce8a31..561bcd876 100644
--- a/roles/network_plugin/calico/tasks/install.yml
+++ b/roles/network_plugin/calico/tasks/install.yml
@@ -8,7 +8,7 @@
 
 - name: Calico | Check if host has NetworkManager
   # noqa 303 Should we use service_facts for this?
-  command: systemctl show NetworkManager
+  command: systemctl is-active --quiet NetworkManager.service
   register: nm_check
   failed_when: false
   changed_when: false
-- 
GitLab