Skip to content

Commit

Permalink
Merge pull request #283 from johanfleury/master
Browse files Browse the repository at this point in the history
Change proxy's configuration file to be consistent with other config files in apt.conf.d
  • Loading branch information
Ashley Penney committed Apr 12, 2014
2 parents d946753 + 9e78925 commit 81a3f9d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
10 changes: 8 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,21 @@
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':
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ class { 'apt':
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
Expand Down Expand Up @@ -117,10 +120,13 @@ class { 'apt':
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
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@
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'
)
Expand Down

0 comments on commit 81a3f9d

Please sign in to comment.