From c84c66f276cef182e21d9c7cb78e827058e5b4f3 Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Wed, 24 Jun 2015 15:21:39 +0200 Subject: [PATCH 1/7] added parameter yum_proxy this allows installing jenkins via yum behind a proxy server. --- manifests/init.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index a2903ecce..d35684174 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 # +# yum_proxy = undef (default) +# If you environment requires a proxy to download yum packages # # proxy_host = undef (default) # proxy_port = undef (default) @@ -153,6 +155,7 @@ $user_hash = {}, $configure_firewall = undef, $install_java = $jenkins::params::install_java, + $yum_proxy = undef, $proxy_host = undef, $proxy_port = undef, $no_proxy_list = undef, From 94964b0248f3cd33a1b1a474d5d53104cc27d482 Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Wed, 24 Jun 2015 15:24:19 +0200 Subject: [PATCH 2/7] use parameter yum_proxy to configure a proxy server for the jenkins yum repo --- manifests/repo/el.pp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manifests/repo/el.pp b/manifests/repo/el.pp index 9b0ab63b1..e5c555946 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}") } + $yum_proxy = $::jenkins::yum_proxy + if $::jenkins::lts { yumrepo {'jenkins': descr => 'Jenkins', @@ -26,4 +28,11 @@ enabled => 1, } } + + if $yum_proxy { + Yumrepo['jenkins'] { + proxy => $yum_proxy, + } + } + } From e360976594d80979ee124f61e85adc31f39f6bf6 Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Wed, 24 Jun 2015 15:25:16 +0200 Subject: [PATCH 3/7] added tests for the yum_proxy parameter --- spec/classes/jenkins_repo_el_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/classes/jenkins_repo_el_spec.rb b/spec/classes/jenkins_repo_el_spec.rb index 23b33da87..6f9221010 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 'yumproxy is set' do + let(:params) { { :yum_proxy => 'http://proxy:8080/' }} + it { should contain_yumrepo('jenkins').with_proxy('http://proxy:8080/') } end end From 2622b200c6b1f913029fb575a904e9262c6cc7a7 Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Thu, 25 Jun 2015 16:23:41 +0200 Subject: [PATCH 4/7] renamed yum_proxy to the more neutral repo_proxy as this parameter could also be used for apt or zypper --- manifests/init.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d35684174..c80d202c0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -125,8 +125,8 @@ # cli_try_sleep = 10 (default) # Seconds between tries to contact jenkins API # -# yum_proxy = undef (default) -# If you environment requires a proxy to download yum packages +# repo_proxy = undef (default) +# If you environment requires a proxy to download packages # # proxy_host = undef (default) # proxy_port = undef (default) @@ -155,7 +155,7 @@ $user_hash = {}, $configure_firewall = undef, $install_java = $jenkins::params::install_java, - $yum_proxy = undef, + $repo_proxy = undef, $proxy_host = undef, $proxy_port = undef, $no_proxy_list = undef, From c32c1349159d268bc7a69b6e77671da941f25781 Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Thu, 25 Jun 2015 16:25:14 +0200 Subject: [PATCH 5/7] yum_proxy was renamed to repo_proxy --- manifests/repo/el.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo/el.pp b/manifests/repo/el.pp index e5c555946..6bef1e34b 100644 --- a/manifests/repo/el.pp +++ b/manifests/repo/el.pp @@ -7,7 +7,7 @@ fail("Use of private class ${name} by ${caller_module_name}") } - $yum_proxy = $::jenkins::yum_proxy + $repo_proxy = $::jenkins::repo_proxy if $::jenkins::lts { yumrepo {'jenkins': From bfec092ded678b6e9890b708f763f0bb4cab908d Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Thu, 25 Jun 2015 16:26:48 +0200 Subject: [PATCH 6/7] move proxy parameter to yumrepo resources instead of using a resource ref move the proxy parameter directly to the yumrepo resources as suggested by @jhoblitt. --- manifests/repo/el.pp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/manifests/repo/el.pp b/manifests/repo/el.pp index 6bef1e34b..0acede621 100644 --- a/manifests/repo/el.pp +++ b/manifests/repo/el.pp @@ -16,6 +16,7 @@ gpgcheck => 1, gpgkey => 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key', enabled => 1, + proxy => $repo_proxy } } @@ -26,13 +27,7 @@ gpgcheck => 1, gpgkey => 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key', enabled => 1, + proxy => $repo_proxy } } - - if $yum_proxy { - Yumrepo['jenkins'] { - proxy => $yum_proxy, - } - } - } From 56b977b502d64429bbadaa7041f1d7bda79d1b84 Mon Sep 17 00:00:00 2001 From: Toni Schmidbauer Date: Thu, 25 Jun 2015 16:31:16 +0200 Subject: [PATCH 7/7] yum_proxy was renamed to repo_proxy so fix the spec --- spec/classes/jenkins_repo_el_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/jenkins_repo_el_spec.rb b/spec/classes/jenkins_repo_el_spec.rb index 6f9221010..8def46463 100644 --- a/spec/classes/jenkins_repo_el_spec.rb +++ b/spec/classes/jenkins_repo_el_spec.rb @@ -16,8 +16,8 @@ it { should contain_yumrepo('jenkins').with_proxy(nil) } end - describe 'yumproxy is set' do - let(:params) { { :yum_proxy => 'http://proxy:8080/' }} + 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