Add __virtual__ functions for pecl and pip states

Similar to what was recently done for npm, disable pecl and pip states
when the needed binary is not available. This prevents tracebacks when
one tries running these states without the required shell command
installed.
This commit is contained in:
Erik Johnson 2013-07-13 17:10:09 -05:00
parent 91e80bc994
commit a9e061540c
2 changed files with 14 additions and 0 deletions

View File

@ -11,6 +11,13 @@ A state module to manage php pecl extensions.
'''
def __virtual__():
'''
Only load if the pecl module is available in __salt__
'''
return 'pecl' if 'pecl.list' in __salt__ else False
def installed(name,
version=None,
defaults=False):

View File

@ -16,6 +16,13 @@ import urlparse
from salt.exceptions import CommandExecutionError, CommandNotFoundError
def __virtual__():
'''
Only load if the pip module is available in __salt__
'''
return 'pip' if 'pip.list' in __salt__ else False
def installed(name,
pip_bin=None,
requirements=None,