Merge pull request #122 from strangeman/master

Add a $key_options parameter to apt::key.
This commit is contained in:
Hunter Haugen 2013-07-02 11:34:21 -07:00
commit add5060d64
2 changed files with 11 additions and 2 deletions

View file

@ -3,7 +3,8 @@ define apt::key (
$ensure = present, $ensure = present,
$key_content = false, $key_content = false,
$key_source = false, $key_source = false,
$key_server = 'keyserver.ubuntu.com' $key_server = 'keyserver.ubuntu.com',
$key_options = false
) { ) {
include apt::params include apt::params
@ -41,11 +42,18 @@ define apt::key (
anchor { "apt::key ${upkey} present": } anchor { "apt::key ${upkey} present": }
} }
if $key_options{
$options_string = "--keyserver-options ${key_options}"
}
else{
$options_string = ''
}
if !defined(Exec[$digest]) { if !defined(Exec[$digest]) {
$digest_command = $method ? { $digest_command = $method ? {
'content' => "echo '${key_content}' | /usr/bin/apt-key add -", 'content' => "echo '${key_content}' | /usr/bin/apt-key add -",
'source' => "wget -q '${key_source}' -O- | apt-key add -", 'source' => "wget -q '${key_source}' -O- | apt-key add -",
'server' => "apt-key adv --keyserver '${key_server}' --recv-keys '${upkey}'", 'server' => "apt-key adv --keyserver '${key_server}' ${options_string} --recv-keys '${upkey}'",
} }
exec { $digest: exec { $digest:
command => $digest_command, command => $digest_command,

View file

@ -2,4 +2,5 @@
apt::key { 'puppetlabs': apt::key { 'puppetlabs':
key => '4BD6EC30', key => '4BD6EC30',
key_server => 'pgp.mit.edu', key_server => 'pgp.mit.edu',
key_options => "http-proxy=\"http://proxyuser:proxypass@example.org:3128\"",
} }