puppet-python icon indicating copy to clipboard operation
puppet-python copied to clipboard

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

Open cboylan opened this issue 5 years ago • 9 comments
trafficstars

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.

cboylan avatar Feb 11 '20 17:02 cboylan

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?

lotashah avatar Feb 13 '20 17:02 lotashah

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

pjonesIDBS avatar Feb 21 '20 16:02 pjonesIDBS

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.

pjonesIDBS avatar May 01 '20 11:05 pjonesIDBS

This issue is resolved in version 4.1.1

saz avatar Jul 10 '20 12:07 saz

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 avatar Jul 31 '20 19:07 GusPriceAtlassian

I created a PR based on the above comment, not 100% certain how it works with your current version tagging: https://github.com/voxpupuli/puppet-python/pull/557

GusPriceAtlassian avatar Jul 31 '20 19:07 GusPriceAtlassian

@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.

pjonesIDBS avatar Aug 03 '20 11:08 pjonesIDBS

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 avatar Aug 04 '20 15:08 GusPriceAtlassian

I will move this conversation to my PR.

GusPriceAtlassian avatar Aug 04 '20 15:08 GusPriceAtlassian