Add the ability to set pip.conf and configure it
Create an initial pip.conf file and allow passing several settings such as index url and trusted hosts. Change-Id: I78962555c9a9ec1a96ce19810a463a5d619b04f9
This commit is contained in:
parent
88c1e708d4
commit
754d3c1539
@ -1,10 +1,24 @@
|
||||
# Class: pip
|
||||
#
|
||||
class pip {
|
||||
class pip (
|
||||
$index_url = 'https://pypi.python.org/simple',
|
||||
$trusted_hosts = [],
|
||||
$manage_pip_conf = false,
|
||||
) {
|
||||
include pip::params
|
||||
validate_array($trusted_hosts)
|
||||
|
||||
package { $::pip::params::python_devel_package:
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
if $manage_pip_conf {
|
||||
file { '/etc/pip.conf':
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0444',
|
||||
content => template('pip/pip.conf.erb'),
|
||||
replace => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
8
templates/pip.conf.erb
Normal file
8
templates/pip.conf.erb
Normal file
@ -0,0 +1,8 @@
|
||||
[global]
|
||||
index-url = <%= @index_url %>
|
||||
<% if trusted_hosts.length > 0 -%>
|
||||
trusted-host =
|
||||
<% @trusted_hosts.each do |trusted_host| -%>
|
||||
<%= trusted_host %>
|
||||
<% end -%>
|
||||
<% end -%>
|
Loading…
x
Reference in New Issue
Block a user