Merged apt::key into apt::repo
This commit is contained in:
parent
78093e1115
commit
ed77786747
1 changed files with 30 additions and 36 deletions
|
@ -132,39 +132,6 @@ define apt::package($ensure, $source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Add apt key.
|
|
||||||
#
|
|
||||||
# === Parameters
|
|
||||||
#
|
|
||||||
# $name:
|
|
||||||
# Key id.
|
|
||||||
# $keyserver:
|
|
||||||
# Name of keyserver.
|
|
||||||
#
|
|
||||||
# === Sample usage
|
|
||||||
#
|
|
||||||
# apt::key { "886DDD89":
|
|
||||||
# keyserver => "keys.gnupg.net",
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
define apt::key($keyserver) {
|
|
||||||
|
|
||||||
include apt
|
|
||||||
|
|
||||||
exec { "apt-key-add":
|
|
||||||
environment => $http_proxy ? {
|
|
||||||
"" => undef,
|
|
||||||
default => "http_proxy=${http_proxy}",
|
|
||||||
},
|
|
||||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
|
||||||
command => "apt-key adv --keyserver ${keyserver} --recv ${name}",
|
|
||||||
unless => "apt-key list | grep '\\b${name}\\b'",
|
|
||||||
notify => Exec["apt-get-update"],
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Add apt repository.
|
# Add apt repository.
|
||||||
#
|
#
|
||||||
# === Parameters
|
# === Parameters
|
||||||
|
@ -177,15 +144,20 @@ define apt::key($keyserver) {
|
||||||
# Distribution name. Defaults to $lsbdistcodename.
|
# Distribution name. Defaults to $lsbdistcodename.
|
||||||
# $components
|
# $components
|
||||||
# Repository components. Defaults to "main".
|
# Repository components. Defaults to "main".
|
||||||
|
# $key:
|
||||||
|
# GPG key id.
|
||||||
|
# $keyserver:
|
||||||
|
# GPG keyserver uri.
|
||||||
#
|
#
|
||||||
# === Sample usage
|
# === Sample usage
|
||||||
#
|
#
|
||||||
# apt::repo { "deb.torproject.org":
|
# apt::repo { "deb.torproject.org":
|
||||||
# source => "http://deb.torproject.org/torproject.org",
|
# source => "http://deb.torproject.org/torproject.org",
|
||||||
# require => Apt::Key["886DDD89"],
|
# key => "886DDD89",
|
||||||
|
# keyserver => "hkp://keys.gnupg.net",
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
define apt::repo($source, $dist="", $components="main") {
|
define apt::repo($source, $dist="", $components="main", $key="", $keyserver="") {
|
||||||
|
|
||||||
if $dist {
|
if $dist {
|
||||||
$dist_real = $dist
|
$dist_real = $dist
|
||||||
|
@ -204,4 +176,26 @@ define apt::repo($source, $dist="", $components="main") {
|
||||||
notify => Exec["apt-get-update"],
|
notify => Exec["apt-get-update"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $key and $keyserver {
|
||||||
|
case $keyserver {
|
||||||
|
/^hkp:.*/: {
|
||||||
|
$command = "apt-key adv --keyserver ${keyserver} --recv ${key}"
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
$command = "apt-key adv --fetch ${keyserver}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { "apt-key-add":
|
||||||
|
environment => $http_proxy ? {
|
||||||
|
"" => undef,
|
||||||
|
default => "http_proxy=${http_proxy}",
|
||||||
|
},
|
||||||
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
|
command => $command,
|
||||||
|
unless => "apt-key list | grep '\\b${key}\\b'",
|
||||||
|
notify => Exec["apt-get-update"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue