Merge pull request #283 from johanfleury/master
Change proxy's configuration file to be consistent with other config files in apt.conf.d
This commit is contained in:
commit
81a3f9d60c
3 changed files with 20 additions and 8 deletions
|
@ -134,9 +134,9 @@ 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',
|
||||
|
@ -144,6 +144,12 @@ Package: bogus-package\n",
|
|||
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':
|
||||
require => Class['apt::update'],
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue