added the ability to specify the content of a key

Allows us to pass key_content when we specify a source.
This commit is contained in:
Dan Bode 2011-06-03 00:20:00 -07:00
parent c42db0fa0f
commit a11af502cd

View file

@ -9,7 +9,8 @@ define apt::source(
$required_packages = false,
$key = false,
$key_server = 'keyserver.ubuntu.com',
$pin = false
$pin = false,
$key_content = false
) {
include apt::params
@ -42,9 +43,17 @@ define apt::source(
}
if $key != false {
exec { "/usr/bin/apt-key adv --keyserver ${key_server} --recv-keys ${key}":
unless => "/usr/bin/apt-key list | grep ${key}",
before => File["${name}.list"],
if $key_content {
exec { "Add key: ${key} from content":
command => "/bin/echo '${key_content}' | /usr/bin/apt-key add -",
unless => "/usr/bin/apt-key list | /bin/grep '${key}'",
before => File["${name}.list"],
}
} else {
exec { "/usr/bin/apt-key adv --keyserver ${key_server} --recv-keys ${key}":
unless => "/usr/bin/apt-key list | /bin/grep ${key}",
before => File["${name}.list"],
}
}
}
}