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 375 forks source link

Module does not recognize Debian python package name #506

Closed atayts closed 4 years ago

atayts commented 5 years ago

Affected Puppet, Ruby, OS and module versions/distributions

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

include python

python::ensure: present python::version: 'python3' python::pip: present python::pip::botstrap::version: 'pip3'

What are you seeing

An error message 'version needs to be pypy, system or a version string like '36', '3.6' or 'python3.6''

What behaviour did you expect instead

Should be working.

Output log

Any additional information you'd like to impart

The cause of a problem is in init.pp code, line 68. It precludes from using a python version 'python3' as it expects a version to be two or more digits in a row or separated by a dot. Debian package is named 'python3' where a version is a single digit, thus not passing verfication of the regexp below.

  unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])+/,
        /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] {
    fail("version needs to be pypy, system or a version string like '36', '3.6' or 'python3.6' )")
  }

The fix is to replace '+' with '*' like this:

  unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])*/,
  ...