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 @@ # 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, + } + } } 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 @@ +[global] +index-url = <%= @index_url %> +<% if trusted_hosts.length > 0 -%> +trusted-host = +<% @trusted_hosts.each do |trusted_host| -%> + <%= trusted_host %> +<% end -%> +<% end -%>