diff --git a/manifests/init.pp b/manifests/init.pp index a2903ecce..c80d202c0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -125,6 +125,8 @@ # cli_try_sleep = 10 (default) # Seconds between tries to contact jenkins API # +# repo_proxy = undef (default) +# If you environment requires a proxy to download packages # # proxy_host = undef (default) # proxy_port = undef (default) @@ -153,6 +155,7 @@ $user_hash = {}, $configure_firewall = undef, $install_java = $jenkins::params::install_java, + $repo_proxy = undef, $proxy_host = undef, $proxy_port = undef, $no_proxy_list = undef, diff --git a/manifests/repo/el.pp b/manifests/repo/el.pp index 9b0ab63b1..0acede621 100644 --- a/manifests/repo/el.pp +++ b/manifests/repo/el.pp @@ -7,6 +7,8 @@ fail("Use of private class ${name} by ${caller_module_name}") } + $repo_proxy = $::jenkins::repo_proxy + if $::jenkins::lts { yumrepo {'jenkins': descr => 'Jenkins', @@ -14,6 +16,7 @@ gpgcheck => 1, gpgkey => 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key', enabled => 1, + proxy => $repo_proxy } } @@ -24,6 +27,7 @@ gpgcheck => 1, gpgkey => 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key', enabled => 1, + proxy => $repo_proxy } } } diff --git a/spec/classes/jenkins_repo_el_spec.rb b/spec/classes/jenkins_repo_el_spec.rb index 23b33da87..8def46463 100644 --- a/spec/classes/jenkins_repo_el_spec.rb +++ b/spec/classes/jenkins_repo_el_spec.rb @@ -7,11 +7,18 @@ context 'repo::el' do describe 'default' do it { should contain_yumrepo('jenkins').with_baseurl('http://pkg.jenkins-ci.org/redhat/') } + it { should contain_yumrepo('jenkins').with_proxy(nil) } end describe 'lts = true' do let(:params) { { :lts => true } } it { should contain_yumrepo('jenkins').with_baseurl('http://pkg.jenkins-ci.org/redhat-stable/') } + it { should contain_yumrepo('jenkins').with_proxy(nil) } + end + + describe 'repo_proxy is set' do + let(:params) { { :repo_proxy => 'http://proxy:8080/' }} + it { should contain_yumrepo('jenkins').with_proxy('http://proxy:8080/') } end end