Add validation for apt::key's name.

It's great to document requirements in README, but error'ing out whenever
the user messes up is even better IMO.
This commit is contained in:
intrigeri 2015-08-31 10:00:09 +00:00
parent 8745de17d6
commit 5f7232b420
2 changed files with 6 additions and 0 deletions

1
README
View file

@ -99,6 +99,7 @@ This module needs:
- the lsb module: git://labs.riseup.net/shared-lsb - the lsb module: git://labs.riseup.net/shared-lsb
- the common module: git://labs.riseup.net/shared-common - the common module: git://labs.riseup.net/shared-common
- the stdlib module: https://forge.puppetlabs.com/puppetlabs/stdlib
By default, on normal hosts, this module sets the configuration option By default, on normal hosts, this module sets the configuration option
DSelect::Clean to 'auto'. On virtual servers, the value is set by default to DSelect::Clean to 'auto'. On virtual servers, the value is set by default to

View file

@ -1,4 +1,9 @@
define apt::key ($source, $ensure = 'present') { define apt::key ($source, $ensure = 'present') {
validate_re(
$name, '\.gpg$',
'An apt::key resource name must have the .gpg extension',
)
file { file {
"/etc/apt/trusted.gpg.d/${name}": "/etc/apt/trusted.gpg.d/${name}":
ensure => $ensure, ensure => $ensure,