mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49938 from s0undt3ch/2018.3
Handle missing `pkg_resources` package
This commit is contained in:
commit
614d1720b9
1 changed files with 7 additions and 1 deletions
|
@ -23,7 +23,11 @@ requisite to a pkg.installed state for the package which provides pip
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import re
|
||||
import logging
|
||||
import pkg_resources
|
||||
try:
|
||||
import pkg_resources
|
||||
HAS_PKG_RESOURCES = True
|
||||
except ImportError:
|
||||
HAS_PKG_RESOURCES = False
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils.versions
|
||||
|
@ -71,6 +75,8 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the pip module is available in __salt__
|
||||
'''
|
||||
if HAS_PKG_RESOURCES is False:
|
||||
return False, 'The pkg_resources python library is not installed'
|
||||
if 'pip.list' in __salt__:
|
||||
return __virtualname__
|
||||
return False
|
||||
|
|
Loading…
Add table
Reference in a new issue