aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-08-31 10:00:09 +0000
committerintrigeri <intrigeri@boum.org>2015-08-31 10:01:03 +0000
commit5f7232b420e02eaa38c14a7be75034d9b3cdd64b (patch)
treead179382d82d8f15174b2ebad1cd6f3c1c35bef7
parent8745de17d64a6eac0eb9f15c19f990fd80383c1f (diff)
downloadpuppet-apt-5f7232b420e02eaa38c14a7be75034d9b3cdd64b.tar.gz
puppet-apt-5f7232b420e02eaa38c14a7be75034d9b3cdd64b.tar.bz2
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.
-rw-r--r--README1
-rw-r--r--manifests/key.pp5
2 files changed, 6 insertions, 0 deletions
diff --git a/README b/README
index 85cf6df..1a83ac9 100644
--- a/README
+++ b/README
@@ -99,6 +99,7 @@ This module needs:
- the lsb module: git://labs.riseup.net/shared-lsb
- 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
DSelect::Clean to 'auto'. On virtual servers, the value is set by default to
diff --git a/manifests/key.pp b/manifests/key.pp
index 7be526e..65b62e9 100644
--- a/manifests/key.pp
+++ b/manifests/key.pp
@@ -1,4 +1,9 @@
define apt::key ($source, $ensure = 'present') {
+ validate_re(
+ $name, '\.gpg$',
+ 'An apt::key resource name must have the .gpg extension',
+ )
+
file {
"/etc/apt/trusted.gpg.d/${name}":
ensure => $ensure,