voxpupuli / puppet-python

Puppet module for installing and managing Python, pip, virtualenvs and Gunicorn virtual hosts.
https://forge.puppetlabs.com/puppet/python
Apache License 2.0
199 stars 370 forks source link

Update virtualenv_version.rb #557

Closed GusPriceAtlassian closed 3 years ago

GusPriceAtlassian commented 3 years ago

Pull Request (PR) description

This Pull Request (PR) fixes the following issues

pjonesIDBS commented 3 years ago

Tested on my local RHEL 7 server the proposed change would reintroduce the previous issues with virtualenv > 20.x: [root@puppet facter]# facter -p virtualenv_version 20.0.29 from /usr/lib/python2.7/site-packages/virtualenv/init.pyc

The current code results in the desired output: [root@puppet facter]# facter -p virtualenv_version 20.0.29

Versions older than 20.x will continue to work normally as before: [root@puppet facter]# facter -p virtualenv_version 15.1.0

This was produced using Python 2.7 but I don't believe it should matter which version of Python is installed...

[root@puppet ~]# file /bin/virtualenv /bin/virtualenv: C++ source, ASCII text

The Puppet fact is simply running this binary and trying to parse the output. It's odd then if we're seeing different results to the Ruby match regex on different systems. Certainly this fix has worked for others as well.

GusPriceAtlassian commented 3 years ago

It's funny, I just ran it all again on my machine in AWS (CentOS 7 marketplace AMI) and got the right result using your Ruby. I think I may have just been in too deep at the end of last week trying to get this to work. But, it's working now, so I will take it! Sorry for the bother, thanks for your help.

pjonesIDBS commented 3 years ago

Hi Gus, no problem! It happens to us all :) Pleased to see another person actively contributing. Glad we don't have a big mystery to delve into this time too. Have a good week.