Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip.installed does not pass env_vars when calling freeze to check if package is already installed #46127

Closed
redbaron4 opened this issue Feb 21, 2018 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior P3 Priority 3 severity-low 4th level, cosemtic problems, work around exists State-Module
Milestone

Comments

@redbaron4
Copy link
Contributor

I have a formula for managing graphite installation which requires PYTHONPATH to be set to a custom directory (without changing the bin_env). The state looks something like

graphite-web:
  pip.installed:
    - name: 'graphite-web{% if graphite_web_version %}=={{graphite_web_version}}{% endif %}'
    - env_vars:
        PYTHONPATH: "/opt/graphite/lib/:/opt/graphite/webapp/"
    - require:
      - file: /opt/graphite

Running this state always results in an output like

----------
          ID: graphite-web
    Function: pip.installed
        Name: graphite-web==1.1.2
      Result: True
     Comment: There was no error installing package 'graphite-web==1.1.2' although it does not show when calling 'pip.freeze'.
     Started: 16:51:54.604922
    Duration: 6326.189 ms
     Changes:   
----------

or something like this with test=True

----------
          ID: graphite-web
    Function: pip.installed
        Name: graphite-web==1.1.2
      Result: None
     Comment: Python package graphite-web==1.1.2 is set to be installed
     Started: 16:55:14.297774
    Duration: 2413.703 ms
     Changes:   
----------

This creates problems in writing dependent states that must only be run in case pip updated the package.

Looking at the code, it looks like pip freeze is called before and after installation to check whether the package is installed/needs installation, but while install is passed env variables, freeze is not.

I am running salt-2017.7.3

I came across a similar bug #37038 but this one is a subset of the issues mentioned there.

@Ch3LL
Copy link
Contributor

Ch3LL commented Feb 21, 2018

seems we will need to update so that freeze command is also passing that env variable. Seems you might have a grasp of a fix if you want to give a go at a PR?

@Ch3LL Ch3LL added State-Module Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists P3 Priority 3 labels Feb 21, 2018
@Ch3LL Ch3LL added this to the Approved milestone Feb 21, 2018
@redbaron4
Copy link
Contributor Author

@Ch3LL I'll try to put in a PR (though it may take a while before I have one ready)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior P3 Priority 3 severity-low 4th level, cosemtic problems, work around exists State-Module
Projects
None yet
Development

No branches or pull requests

3 participants