File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030# requirements => '/var/www/project1/requirements.txt',
3131# proxy => 'http://proxy.domain.com:3128',
3232# systempkgs => true,
33+ # index => 'http://www.example.com/simple/'
3334# }
3435#
3536# === Authors
4748 $distribute = true ,
4849 $owner = ' root' ,
4950 $group = ' root'
51+ $index = false ,
5052) {
5153
5254 $venv_dir = $name
7779 true => ' distribute' ,
7880 default => ' ' ,
7981 }
82+ $pypi_index = $index ? {
83+ false => ' ' ,
84+ default => " -i ${index} " ,
85+ }
86+
8087
8188 exec { "python_virtualenv_${venv_dir}" :
8289 command => " mkdir -p ${venv_dir} \
8390 ${proxy_command} \
8491 && virtualenv -p `which ${python} ` ${system_pkgs_flag} ${venv_dir} \
85- && ${venv_dir} /bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip" ,
92+ && ${venv_dir} /bin/pip install ${pypi_index} ${ proxy_flag} --upgrade ${distribute_pkg} pip" ,
8693 user => $owner ,
8794 creates => $venv_dir ,
8895 path => [ ' /bin' , ' /usr/bin' , ' /usr/sbin' ],
98105
99106 if $requirements {
100107 exec { "python_requirements_initial_install_${requirements}_${venv_dir}" :
101- command => " ${venv_dir} /bin/pip install ${proxy_flag} --requirement ${requirements} " ,
108+ command => " ${venv_dir} /bin/pip install ${pypi_index} ${ proxy_flag} --requirement ${requirements} " ,
102109 refreshonly => true ,
103110 timeout => 1800,
104111 user => $owner ,
You can’t perform that action at this time.
0 commit comments