File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -894,6 +894,11 @@ Create a Python3 virtualenv using pyvenv.
894894#####
895895
896896``` puppet
897+ class { 'python':
898+ version => 'system',
899+ venv => 'present',
900+ }
901+
897902python::pyvenv { '/var/www/project1' :
898903 ensure => present,
899904 version => 'system',
Original file line number Diff line number Diff line change 11class { 'python' :
2- pip => false ,
2+ pip => ' absent' ,
3+ venv => ' present' ,
34 version => ' 3' ,
45}
56
Original file line number Diff line number Diff line change 66#
77class python::install {
88 $python = $python::version ? {
9- ' system' => ' python' ,
9+ ' system' => $facts [' os' ][' family' ] ? {
10+ ' Debian' => ' python3' ,
11+ ' RedHat' => ' python3' ,
12+ default => ' python' ,
13+ },
1014 ' pypy' => ' pypy' ,
1115 /\A(python[23]\.[0-9]+)/ => $1,
1216 /\A(python)?([0-9]+)/ => " python${2}" ,
Original file line number Diff line number Diff line change 1414# @param python_path Optionally specify python path for creation of virtualenv
1515#
1616# @example
17+ # class { 'python':
18+ # version => 'system',
19+ # venv => 'present',
20+ # }
21+ #
1722# python::pyvenv { '/var/www/project1' :
1823# ensure => present,
1924# version => 'system',
Original file line number Diff line number Diff line change @@ -235,4 +235,21 @@ class { 'python':
235235 its ( :stdout ) { is_expected . to match %r{agent.* 0\. 1\. 2} }
236236 end
237237 end
238+
239+ context "with version => 'system'" do
240+ it 'works with no errors' do
241+ pp = <<-PUPPET
242+ class { 'python':
243+ version => 'system',
244+ venv => 'present',
245+ }
246+ python::pyvenv { '/opt/regress700':
247+ ensure => 'present',
248+ }
249+ PUPPET
250+
251+ apply_manifest ( pp , catch_failures : true )
252+ apply_manifest ( pp , catch_changes : true )
253+ end
254+ end
238255end
Original file line number Diff line number Diff line change 6363 it { is_expected . to contain_package ( 'python-venv' ) . with ( ensure : 'present' ) } unless facts [ :os ] [ 'family' ] == 'RedHat'
6464 end
6565
66+ if facts [ :os ] [ 'family' ] == 'Debian'
67+ context "with version => 'system' on Debian family" do
68+ let ( :params ) { { version : 'system' , venv : 'present' } }
69+
70+ it { is_expected . to contain_package ( 'python-venv' ) . with ( name : 'python3-venv' , ensure : 'present' ) }
71+ end
72+ end
73+
74+ if %w[ Debian RedHat ] . include? ( facts [ :os ] [ 'family' ] )
75+ context "with version => 'system'" do
76+ let ( :params ) { { version : 'system' } }
77+
78+ it { is_expected . to contain_package ( 'python' ) . with ( name : 'python3' ) }
79+ end
80+ end
81+
6682 case facts [ :os ] [ 'family' ]
6783 when 'Debian'
6884
You can’t perform that action at this time.
0 commit comments