Skip to content

Commit

Permalink
Merge pull request #146 from botify-labs/handle_ppa_options
Browse files Browse the repository at this point in the history
Fix: parametrize apt::ppa class for beign able to pass options to apt-add-repository command
  • Loading branch information
Ashley Penney committed Jul 17, 2013
2 parents 62e7faf + 1e940d1 commit e4fe87c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions manifests/ppa.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ppa.pp

define apt::ppa(
$release = $::lsbdistcodename
$release = $::lsbdistcodename,
$options = "-y"
) {
include apt::params
include apt::update
Expand Down Expand Up @@ -40,7 +41,7 @@
}
exec { "add-apt-repository-${name}":
environment => $proxy_env,
command => "/usr/bin/add-apt-repository ${name}",
command => "/usr/bin/add-apt-repository ${options} ${name}",
creates => "${sources_list_d}/${sources_list_d_filename}",
logoutput => 'on_failure',
require => [
Expand Down
7 changes: 5 additions & 2 deletions spec/defines/ppa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
let :package do
"#{platform[:package]}"
end
let :options do
"-y"
end
['ppa:dans_ppa', 'dans_ppa','ppa:dans-daily/ubuntu'].each do |t|
describe "with title #{t}" do
let :pre_condition do
Expand All @@ -41,7 +44,7 @@
}

it { should contain_exec("add-apt-repository-#{t}").with(
'command' => "/usr/bin/add-apt-repository #{t}",
'command' => "/usr/bin/add-apt-repository #{options} #{t}",
'creates' => "/etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]"
Expand Down Expand Up @@ -73,7 +76,7 @@
"http_proxy=http://user:pass@proxy:8080",
"https_proxy=http://user:pass@proxy:8080",
],
'command' => "/usr/bin/add-apt-repository #{title}",
'command' => "/usr/bin/add-apt-repository #{options} #{title}",
'creates' => "/etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]"
Expand Down

0 comments on commit e4fe87c

Please sign in to comment.