Merge pull request #330 from dantman/master
authorMorgan Haskel <morgan@puppetlabs.com>
Wed, 30 Jul 2014 18:44:51 +0000 (14:44 -0400)
committerMorgan Haskel <morgan@puppetlabs.com>
Wed, 30 Jul 2014 18:44:51 +0000 (14:44 -0400)
Fix inconsistent $proxy_host handling in apt and apt::ppa.

manifests/init.pp
manifests/ppa.pp

index 597774c8338775a56e1e64c1d3a03ffe8ceb59ce..1c318b67ca979259ef79933b6b0faf2dedb85f7d 100644 (file)
@@ -139,19 +139,25 @@ class apt(
     default: { fail('Valid values for disable_keys are true or false') }
   }
 
-  $proxy_set = $proxy_host ? {
-    undef   => absent,
-    default => present
-  }
-
-  file { '01proxy':
-    ensure  => $proxy_set,
-    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,
+  case $proxy_host {
+    false, '', undef: {
+      file { '01proxy':
+        ensure  => absent,
+        path    => "${apt_conf_d}/01proxy",
+        notify  => Exec['apt_update'],
+      }
+    }
+    default: {
+      file { '01proxy':
+        ensure  => present,
+        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':
index a55e1e0e5c7a075b04ee4861370d40e107a42254..27edff80b21864539f1ca9eb86cfa6cc0f2a8979 100644 (file)
@@ -36,11 +36,13 @@ define apt::ppa(
     if defined(Class[apt]) {
         $proxy_host = $apt::proxy_host
         $proxy_port = $apt::proxy_port
-        case  $proxy_host {
-        false, '': {
+        case $proxy_host {
+          false, '', undef: {
             $proxy_env = []
-        }
-        default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]}
+          }
+          default: {
+            $proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]
+          }
         }
     } else {
         $proxy_env = []