2023-05-05 11:15:58 +02:00
|
|
|
From 4060d4cd24ac0fbcf83c1521553921d76c070a57 Mon Sep 17 00:00:00 2001
|
2019-01-17 10:18:02 +01:00
|
|
|
From: Bo Maryniuk <bo@suse.de>
|
|
|
|
Date: Fri, 21 Sep 2018 17:31:39 +0200
|
|
|
|
Subject: [PATCH] Do not load pip state if there is no 3rd party
|
|
|
|
dependencies
|
|
|
|
|
|
|
|
Safe import 3rd party dependency
|
|
|
|
---
|
2021-09-27 12:08:32 +02:00
|
|
|
salt/modules/pip.py | 13 ++++++++++++-
|
|
|
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
2019-01-17 10:18:02 +01:00
|
|
|
|
|
|
|
diff --git a/salt/modules/pip.py b/salt/modules/pip.py
|
2023-05-05 11:15:58 +02:00
|
|
|
index c4de0c2984..a60bdca0bb 100644
|
2019-01-17 10:18:02 +01:00
|
|
|
--- a/salt/modules/pip.py
|
|
|
|
+++ b/salt/modules/pip.py
|
2021-09-27 12:08:32 +02:00
|
|
|
@@ -96,6 +96,12 @@ import salt.utils.url
|
|
|
|
import salt.utils.versions
|
2021-01-08 13:41:50 +01:00
|
|
|
from salt.exceptions import CommandExecutionError, CommandNotFoundError
|
|
|
|
|
2019-01-17 10:18:02 +01:00
|
|
|
+try:
|
|
|
|
+ import pkg_resources
|
|
|
|
+except ImportError:
|
|
|
|
+ pkg_resources = None
|
2021-01-08 13:41:50 +01:00
|
|
|
+
|
|
|
|
+
|
|
|
|
# This needs to be named logger so we don't shadow it in pip.install
|
2021-09-27 12:08:32 +02:00
|
|
|
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
|
2021-01-08 13:41:50 +01:00
|
|
|
|
2023-01-09 13:52:13 +01:00
|
|
|
@@ -114,7 +120,12 @@ def __virtual__():
|
2019-01-17 10:18:02 +01:00
|
|
|
entire filesystem. If it's not installed in a conventional location, the
|
|
|
|
user is required to provide the location of pip each time it is used.
|
2021-01-08 13:41:50 +01:00
|
|
|
"""
|
|
|
|
- return "pip"
|
2019-01-17 10:18:02 +01:00
|
|
|
+ if pkg_resources is None:
|
|
|
|
+ ret = False, 'Package dependency "pkg_resource" is missing'
|
|
|
|
+ else:
|
2021-01-08 13:41:50 +01:00
|
|
|
+ ret = "pip"
|
2019-01-17 10:18:02 +01:00
|
|
|
+
|
|
|
|
+ return ret
|
|
|
|
|
|
|
|
|
2020-04-30 16:20:16 +02:00
|
|
|
def _pip_bin_env(cwd, bin_env):
|
2019-01-17 10:18:02 +01:00
|
|
|
--
|
2023-05-05 11:15:58 +02:00
|
|
|
2.39.2
|
2019-01-17 10:18:02 +01:00
|
|
|
|
|
|
|
|