From: Johan Fleury Date: Fri, 11 Apr 2014 06:35:25 +0000 (+0200) Subject: Writing proxy configuration in apt.conf.d/01proxy. X-Git-Tag: 1.5.0~11^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=9e789255c84eec71727ff1dfb05cec63258ac0d1;p=puppet-modules%2Fpuppetlabs-apt.git Writing proxy configuration in apt.conf.d/01proxy. This commit changes the proxy file name to be more consistent with other files in `apt.conf.d`. The old file (`apt.conf.d/proxy`) is removed. Tests has been updated. --- diff --git a/manifests/init.pp b/manifests/init.pp index 85055c8..1c3f902 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -134,15 +134,21 @@ Package: bogus-package\n", default => present } - file { 'configure-apt-proxy': + file { '01proxy': ensure => $proxy_set, - path => "${apt_conf_d}/proxy", + path => "${apt_conf_d}/01proxy", content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n", notify => Exec['apt_update'], mode => '0644', owner => root, group => root, } + + file { 'old-proxy-file': + ensure => absent, + path => "${apt_conf_d}/proxy", + notify => Exec['apt_update'], + } # Need anchor to provide containment for dependencies. anchor { 'apt::update': diff --git a/spec/acceptance/apt_spec.rb b/spec/acceptance/apt_spec.rb index 84b7f88..f89976e 100644 --- a/spec/acceptance/apt_spec.rb +++ b/spec/acceptance/apt_spec.rb @@ -75,10 +75,13 @@ describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily') apply_manifest(pp, :catch_failures => true) end - describe file('/etc/apt/apt.conf.d/proxy') do + describe file('/etc/apt/apt.conf.d/01proxy') do it { should be_file } it { should contain 'Acquire::http::Proxy "http://localhost:7042\";' } end + describe file('/etc/apt/apt.conf.d/proxy') do + it { should_not be_file } + end end context 'purge_sources' do @@ -117,10 +120,13 @@ describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily') apply_manifest(pp, :catch_failures => true) end - describe file('/etc/apt/apt.conf.d/proxy') do + describe file('/etc/apt/apt.conf.d/01proxy') do it { should be_file } it { should contain 'Acquire::http::Proxy "http://localhost:7042\";' } end + describe file('/etc/apt/apt.conf.d/proxy') do + it { should_not be_file } + end end context 'purge_sources' do diff --git a/spec/classes/apt_spec.rb b/spec/classes/apt_spec.rb index 0b67756..9f18a91 100644 --- a/spec/classes/apt_spec.rb +++ b/spec/classes/apt_spec.rb @@ -162,14 +162,14 @@ describe 'apt', :type => :class do describe 'when setting a proxy' do it { if param_hash[:proxy_host] - should contain_file('configure-apt-proxy').with( - 'path' => '/etc/apt/apt.conf.d/proxy', + should contain_file('01proxy').with( + 'path' => '/etc/apt/apt.conf.d/01proxy', 'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";\n", 'notify' => "Exec[apt_update]" ) else - should contain_file('configure-apt-proxy').with( - 'path' => '/etc/apt/apt.conf.d/proxy', + should contain_file('01proxy').with( + 'path' => '/etc/apt/apt.conf.d/01proxy', 'notify' => 'Exec[apt_update]', 'ensure' => 'absent' )