From 598558b14d880adbff6b6b76b1a7ddd422e10f66 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Wed, 3 Apr 2019 14:01:30 +0100 Subject: [PATCH] Update version validation Fixes #471 --- manifests/init.pp | 4 ++-- manifests/install.pp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a62975b5..d3c276fc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,7 +29,7 @@ # @example install python3 from scl repo # class { 'python' : # ensure => 'present', -# version => 'rh-python36-python', +# version => 'rh-python36', # dev => 'present', # virtualenv => 'present', # } @@ -64,7 +64,7 @@ } unless $version =~ Pattern[/\A(python)?[0-9](\.[0-9])+/, - /\Apypy\Z/, /\Asystem\Z/] { + /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}\Z/] { fail("version needs to be pypy, system or a version string like '3.5' or 'python3.5)") } diff --git a/manifests/install.pp b/manifests/install.pp index 22ae9e4a..63c88079 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -8,10 +8,11 @@ $python_version = getparam(Class['python'], 'version') $python = $python_version ? { - 'system' => 'python', - 'pypy' => 'pypy', + 'system' => 'python', + 'pypy' => 'pypy', /\A(python)?([0-9](\.?[0-9])+)/ => "python${2}", - default => "python${python::version}", + /\Arh-python[0-9]{2}/ => $python_version, + default => "python${python::version}", } $pythondev = $facts['os']['family'] ? {