From 03b966f6c6898b882ecb26dd976ea88dc339fa23 Mon Sep 17 00:00:00 2001 From: Julien Cigar Date: Mon, 10 Aug 2015 15:00:07 +0200 Subject: [PATCH] proposed fix for #26155 --- salt/states/pip_state.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/salt/states/pip_state.py b/salt/states/pip_state.py index a3f3ff18f6..9941ede6f6 100644 --- a/salt/states/pip_state.py +++ b/salt/states/pip_state.py @@ -59,7 +59,11 @@ def __virtual__(): ''' Only load if the pip module is available in __salt__ ''' - if HAS_PIP and 'pip.list' in __salt__: + if not HAS_PIP: + logger.warning( + 'An importable pip module could not be found on your system' + ) + if 'pip.list' in __salt__: return __virtualname__ return False @@ -100,6 +104,16 @@ def _check_pkg_version_format(pkg): ret = {'result': False, 'comment': None, 'prefix': None, 'version_spec': None} + + if not HAS_PIP: + ret['comment'] = ( + 'An importable pip module is required but could not be found on ' + 'your system. This usually means that the system''s pip package ' + 'is not installed properly.' + ) + + return ret + from_vcs = False try: # Get the requirement object from the pip library