SHA256
1
0
forked from pool/salt
salt/avoid-has_docker-true-if-import-messes-with-salt.uti.patch

35 lines
920 B
Diff

From f942aeb3eb64b99cd9432bebf021835ade46df74 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