File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,11 +64,14 @@ Creates Python virtualenv.
6464
6565** proxy** — Proxy server to use for outbound connections. Default: none
6666
67+ ** systempkgs** — Copy system site-packages into virtualenv. Default: don't
68+
6769 python::virtualenv { '/var/www/project1':
6870 ensure => present,
6971 version => 'system',
7072 requirements => '/var/www/project1/requirements.txt',
7173 proxy => 'http://proxy.domain.com:3128',
74+ systempkgs => true,
7275 }
7376
7477### python::gunicorn
Original file line number Diff line number Diff line change 1616# [*proxy*]
1717# Proxy server to use for outbound connections. Default: none
1818#
19+ # [*systempkgs*]
20+ # Copy system site-packages into virtualenv. Default: don't
21+ #
1922# === Examples
2023#
2124# python::virtualenv { '/var/www/project1':
2225# ensure => present,
2326# version => 'system',
2427# requirements => '/var/www/project1/requirements.txt',
2528# proxy => 'http://proxy.domain.com:3128',
29+ # systempkgs => true,
2630# }
2731#
2832# === Authors
3337 $ensure = present ,
3438 $version = ' system' ,
3539 $requirements = false ,
36- $proxy = false
40+ $proxy = false ,
41+ $systempkgs = false ,
3742) {
3843
3944 $venv_dir = $name
5560 default => " && export http_proxy=${proxy} " ,
5661 }
5762
63+ $system_pkgs_flag = $systempkgs ? {
64+ false => ' ' ,
65+ default => ' --system-site-packages' ,
66+ }
67+
5868 exec { "python_virtualenv_${venv_dir}" :
5969 command => " mkdir -p ${venv_dir} \
6070 ${proxy_command} \
61- && virtualenv -p `which ${python} ` ${venv_dir} \
71+ && virtualenv -p `which ${python} ` ${system_pkgs_flag} ${ venv_dir} \
6272 && ${venv_dir} /bin/pip install ${proxy_flag} --upgrade distribute pip" ,
6373 creates => $venv_dir ,
6474 }
Original file line number Diff line number Diff line change 99 version => ' system' ,
1010 requirements => ' /var/www/project1/requirements.txt' ,
1111 proxy => ' http://proxy.domain.com:3128' ,
12+ systempkgs => true ,
1213}
You can’t perform that action at this time.
0 commit comments