mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #14373 from cachedout/14295
Avoid error in pip uninstall
This commit is contained in:
commit
313b3874ee
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user