Skip to content

Commit

Permalink
Merge pull request #330 from dantman/master
Browse files Browse the repository at this point in the history
Fix inconsistent $proxy_host handling in apt and apt::ppa.
  • Loading branch information
Morgan Haskel committed Jul 30, 2014
2 parents bc2febe + 562e702 commit 84b53dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
32 changes: 19 additions & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,25 @@
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':
Expand Down
10 changes: 6 additions & 4 deletions manifests/ppa.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
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 = []
Expand Down

0 comments on commit 84b53dc

Please sign in to comment.