summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYolanda Robla <yolanda.robla-mota@hp.com>2015-03-27 13:02:38 +0100
committerYolanda Robla <yolanda.robla-mota@hp.com>2015-04-10 08:18:22 +0200
commit754d3c15396fdcc9f05214434e25f1922bab8f96 (patch)
tree4899e52856935cc7eb0ea89d429034724e6c312e
parent88c1e708d421f397283fd88266147175855426dd (diff)
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
Notes
Notes (review): Code-Review+2: Monty Taylor <mordred@inaugust.com> Verified+2: Jenkins Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Code-Review+1: Spencer Krum <nibz@spencerkrum.com> Submitted-by: Jenkins Submitted-at: Mon, 20 Apr 2015 19:53:29 +0000 Reviewed-on: https://review.openstack.org/168309 Project: openstack-infra/puppet-pip Branch: refs/heads/master
-rw-r--r--manifests/init.pp16
-rw-r--r--templates/pip.conf.erb8
2 files changed, 23 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 731691e..1e210f1 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,10 +1,24 @@
1# Class: pip 1# Class: pip
2# 2#
3class pip { 3class pip (
4 $index_url = 'https://pypi.python.org/simple',
5 $trusted_hosts = [],
6 $manage_pip_conf = false,
7) {
4 include pip::params 8 include pip::params
9 validate_array($trusted_hosts)
5 10
6 package { $::pip::params::python_devel_package: 11 package { $::pip::params::python_devel_package:
7 ensure => present, 12 ensure => present,
8 } 13 }
9 14
15 if $manage_pip_conf {
16 file { '/etc/pip.conf':
17 owner => 'root',
18 group => 'root',
19 mode => '0444',
20 content => template('pip/pip.conf.erb'),
21 replace => true,
22 }
23 }
10} 24}
diff --git a/templates/pip.conf.erb b/templates/pip.conf.erb
new file mode 100644
index 0000000..c0b957d
--- /dev/null
+++ b/templates/pip.conf.erb
@@ -0,0 +1,8 @@
1[global]
2index-url = <%= @index_url %>
3<% if trusted_hosts.length > 0 -%>
4trusted-host =
5<% @trusted_hosts.each do |trusted_host| -%>
6 <%= trusted_host %>
7<% end -%>
8<% end -%>