File avoid-has_docker-true-if-import-messes-with-salt.uti.patch of Package salt.18653

From 8ccd2d94da88742401451016b6ea351676e83ffa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
 <psuarezhernandez@suse.com>
Date: Thu, 28 May 2020 16:38:04 +0100
Subject: [PATCH] Avoid HAS_DOCKER true if import messes with
 salt.utils.docker (bsc#1172075)

---
 salt/modules/swarm.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/salt/modules/swarm.py b/salt/modules/swarm.py
index ea327ce640040bdbd7e7077bc6bbb59a9f0ade4a..6f16f41ece01738f3a04d11211fa5e96cd8155b4 100644
--- a/salt/modules/swarm.py
+++ b/salt/modules/swarm.py
@@ -30,9 +30,13 @@ from __future__ import absolute_import, unicode_literals, print_function
 # Import Salt libs
 import salt.utils.json
 
+HAS_DOCKER = False
+
 try:
     import docker
-    HAS_DOCKER = True
+
+    if hasattr(docker, "from_env"):
+        HAS_DOCKER = True
 except ImportError:
     HAS_DOCKER = False
 
-- 
2.23.0


openSUSE Build Service is sponsored by