From: Pierre Gambarotto Date: Tue, 16 Jul 2013 07:52:06 +0000 (+0200) Subject: ppa: fix empty environment definition in exec ressource when no proxy X-Git-Tag: 1.3.0~6^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=19fbdab7945cb9bdb42ef53de2106a03f6bbd236;p=puppet-modules%2Fpuppetlabs-apt.git ppa: fix empty environment definition in exec ressource when no proxy --- diff --git a/manifests/ppa.pp b/manifests/ppa.pp index f234f74..6cb921f 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -30,13 +30,13 @@ define apt::ppa( $proxy_host = getparam(Class[apt], "proxy_host") $proxy_port = getparam(Class[apt], "proxy_port") case $proxy_host { - false: { - $proxy_env = "" + false, "": { + $proxy_env = [] } default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]} } } else { - $proxy_env = "" + $proxy_env = [] } exec { "add-apt-repository-${name}": environment => $proxy_env, diff --git a/spec/defines/ppa_spec.rb b/spec/defines/ppa_spec.rb index 3baa7e8..b768b25 100644 --- a/spec/defines/ppa_spec.rb +++ b/spec/defines/ppa_spec.rb @@ -55,6 +55,29 @@ describe 'apt::ppa', :type => :define do } 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 let :title do 'rspec_ppa'