Merge pull request #145 from PierreGambarotto/master
ppa: fix empty environment definition in exec ressource when no proxy
This commit is contained in:
commit
6cde028332
2 changed files with 26 additions and 3 deletions
|
@ -31,13 +31,13 @@ define apt::ppa(
|
||||||
$proxy_host = getparam(Class[apt], "proxy_host")
|
$proxy_host = getparam(Class[apt], "proxy_host")
|
||||||
$proxy_port = getparam(Class[apt], "proxy_port")
|
$proxy_port = getparam(Class[apt], "proxy_port")
|
||||||
case $proxy_host {
|
case $proxy_host {
|
||||||
false: {
|
false, "": {
|
||||||
$proxy_env = ""
|
$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 {
|
} else {
|
||||||
$proxy_env = ""
|
$proxy_env = []
|
||||||
}
|
}
|
||||||
exec { "add-apt-repository-${name}":
|
exec { "add-apt-repository-${name}":
|
||||||
environment => $proxy_env,
|
environment => $proxy_env,
|
||||||
|
|
|
@ -58,6 +58,29 @@ describe 'apt::ppa', :type => :define do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
describe 'without a proxy defined' do
|
||||||
|
let :title do
|
||||||
|
'rspec_ppa'
|
||||||
|
end
|
||||||
|
let :pre_condition do
|
||||||
|
'class { "apt":
|
||||||
|
proxy_host => false
|
||||||
|
}'
|
||||||
|
end
|
||||||
|
let :filename do
|
||||||
|
"#{title}-#{release}.list"
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_exec("add-apt-repository-#{title}").with(
|
||||||
|
'environment' => [],
|
||||||
|
'command' => "/usr/bin/add-apt-repository #{title}",
|
||||||
|
'creates' => "/etc/apt/sources.list.d/#{filename}",
|
||||||
|
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
|
||||||
|
'notify' => "Exec[apt_update]"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe 'behind a proxy' do
|
describe 'behind a proxy' do
|
||||||
let :title do
|
let :title do
|
||||||
'rspec_ppa'
|
'rspec_ppa'
|
||||||
|
|
Loading…
Reference in a new issue