]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Add validation for apt::key's name.
authorintrigeri <intrigeri@boum.org>
Mon, 31 Aug 2015 10:00:09 +0000 (10:00 +0000)
committerintrigeri <intrigeri@boum.org>
Mon, 31 Aug 2015 10:01:03 +0000 (10:01 +0000)
It's great to document requirements in README, but error'ing out whenever
the user messes up is even better IMO.

README
manifests/key.pp

diff --git a/README b/README
index 85cf6df7d181f0678452d0f94e223f1a86c91161..1a83ac99e4ef6784d4dce7f7a5c707d3237f181f 100644 (file)
--- 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
index 7be526e1c675fca0ed11529ff83daa2fb050b590..65b62e93fc0212f506b4b94cc4e6390ba40ad1d0 100644 (file)
@@ -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,