diff --git a/salt/modules/pip.py b/salt/modules/pip.py index 594720afbe..0083d2de51 100644 --- a/salt/modules/pip.py +++ b/salt/modules/pip.py @@ -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)