Merge pull request #14373 from cachedout/14295

Avoid error in pip uninstall
This commit is contained in:
Thomas S Hatch 2014-07-22 12:41:51 -06:00
commit 313b3874ee

View File

@ -571,7 +571,7 @@ def uninstall(pkgs=None,
pkgs
comma separated list of packages to install
requirements
path to requirements
path to requirements.
bin_env
path to pip bin or path to virtualenv. If doing an uninstall from
the system python and want to use a specific pip bin (pip-2.7,
@ -702,6 +702,15 @@ def uninstall(pkgs=None,
if pkgs:
if isinstance(pkgs, string_types):
pkgs = [p.strip() for p in pkgs.split(',')]
if requirements:
with salt.utils.fopen(requirement) as rq_:
for req in rq_:
try:
req_pkg, _ = req.split('==')
if req_pkg in pkgs:
pkgs.remove(req_pkg)
except ValueError:
pass
cmd.extend(pkgs)
cmd_kwargs = dict(runas=user, cwd=cwd, saltenv=saltenv)