poise / python

THIS COOKBOOK IS DEPRECATED – Chef cookbook to install Python and related tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: `python_pip` reinstalls packages that contain underscore in their names

hltbra opened this issue · comments

The current check for installed packages uses pip freeze | grep -i '^#{new_resource.package_name}==', but pip freeze reports packages with underscore as hyphens: https://github.com/pypa/pip/blob/95035fc5c4cae354e17048c1a7727f4ad766662c/pip/util.py#L186

This issue is very serious to my current work, because I rely on pip_python's updated_by_last_action value to notify supervisor to restart, and my supervisor processes were restarting every time chef runs, even if the package was already installed. My cookbook looks like:

python_pip pkg_name do
  version pkg_version
  action :install
  virtualenv venv_home
  notifies :run, "execute[supervisor:update_and_restart]"
end

I am working on a fix and gonna send a pull request soon.