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

Virtualenv>=20.0.0 has new version command output breaking virtualenv_version fact #534

Open
cboylan opened this issue Feb 11, 2020 · 9 comments

Comments

@cboylan
Copy link

cboylan commented Feb 11, 2020

Affected Puppet, Ruby, OS and module versions/distributions

We are running old everything, but the facter fact, https://github.com/voxpupuli/puppet-python/blob/master/lib/facter/virtualenv_version.rb, hasn't been changed in a while.

How to reproduce (e.g Puppet code you use)

Try to use virtualenv_version fact when virtualenv>=20.0.0 is installed

What are you seeing

error while resolving custom fact "virtualenv_version": undefined method `[]' for nil:NilClass

What behaviour did you expect instead

virtualenv_version is defined with a version value.

Any additional information you'd like to impart

This happens because virtualenv>=20.0.0 is a major rewrite and changes the output of the virtualenv --version command.

Old virtualenv:

$ virtualenv --version
16.7.5

New virtualenv:

$ ~/venv/bin/virtualenv --version
virtualenv 20.0.1 from /home/clark/venv/lib/python2.7/site-packages/virtualenv/__init__.pyc

The fact's output parsing will need to be updated to handle both cases.

@lotashah
Copy link

lotashah commented Feb 13, 2020

for what it's worth, there's additional issues beyond fixing the version fact regex. latest virtualenv removed the deprecated --no-site-packages CLI flag.

as a workaround, is there a way to specify a virtualenv to use version explicitly?

@pjonesIDBS
Copy link
Contributor

Am seeing this issue too. Do we have any estimates on when an official fix will be available?

@pjonesIDBS
Copy link
Contributor

We will need a new version of puppet-puppetboard to be released with support for puppet-python up to 4.1.1 so we can clear this issue from our Puppet environments.

@saz
Copy link
Sponsor Contributor

saz commented Jul 10, 2020

This issue is resolved in version 4.1.1

krissik pushed a commit to krissik/puppet-python that referenced this issue Jul 30, 2020
This should fix issue voxpupuli#534 I've tested locally with success. I've tested against Virtualenv 20.0.4 and 16.7.9.
The output from the fact is only the version number as was previously the case.
@GusPriceAtlassian
Copy link

Hi @krissik and @pjonesIDBS I was looking at this, and running into issues. It turned out my issues were due to not declaring syspkgs, BUT, I do think you're regex update in the commit here is incorrect. You're pointing to value [1] will return "from" instead of the actual virtualenv version number. I tested this by forking and adding a simple notify statement in a puppetfile to print out the value.

@GusPriceAtlassian
Copy link

I created a PR based on the above comment, not 100% certain how it works with your current version tagging: #557

@pjonesIDBS
Copy link
Contributor

@GusPriceAtlassian, thanks for the feedback. What OS and release are you running? I'm unable to replicate your problem. The change you've proposed in #557 actually breaks things again on a CentOS 7 system. Maybe the issue relates to the version of Ruby and how it's match regex function is working.

@GusPriceAtlassian
Copy link

I'm on CentOS 7 as well, specifically this AMI in AWS: https://aws.amazon.com/marketplace/pp/Centosorg-CentOS-7-x8664-with-Updates-HVM/B00O7WM7QW

@GusPriceAtlassian
Copy link

I will move this conversation to my PR.

russellshackleford pushed a commit to russellshackleford/puppet-python that referenced this issue Sep 28, 2020
This should fix issue voxpupuli#534 I've tested locally with success. I've tested against Virtualenv 20.0.4 and 16.7.9.
The output from the fact is only the version number as was previously the case.
kali-brandwatch pushed a commit to BrandwatchLtd/puppet-python that referenced this issue Feb 20, 2024
This should fix issue voxpupuli#534 I've tested locally with success. I've tested against Virtualenv 20.0.4 and 16.7.9.
The output from the fact is only the version number as was previously the case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants