Writing proxy configuration in apt.conf.d/01proxy.
authorJohan Fleury <johan.fleury@trinaps.com>
Fri, 11 Apr 2014 06:35:25 +0000 (08:35 +0200)
committerJohan Fleury <johan.fleury@trinaps.com>
Fri, 11 Apr 2014 11:56:29 +0000 (13:56 +0200)
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.

manifests/init.pp
spec/acceptance/apt_spec.rb
spec/classes/apt_spec.rb

index 85055c8119101b66b14566201816d749829995cd..1c3f902ada5c9f9c953e908581c31a5483113959 100644 (file)
@@ -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':
index 84b7f88281c1f6b7deda07779220f194ef4f200d..f89976e4000cbbf53dda2340c5159695b52c7dc0 100644 (file)
@@ -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
index 0b677564d1d1cbc84193369f1e1c078e75be4b6d..9f18a9126454ae1e2807117dd6d24305c2e4166a 100644 (file)
@@ -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'
             )