summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-01-15 12:35:28 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-01-15 12:35:28 +0100
commit72598df7c3ed57afd0047bae1da808bfc6e885b4 (patch)
tree546680d05f39389fb4ee1ac6ab84c2806808dd47
parentChange to use HugoNikanor/letsencrypt. (diff)
downloadcgit-72598df7c3ed57afd0047bae1da808bfc6e885b4.tar.gz
cgit-72598df7c3ed57afd0047bae1da808bfc6e885b4.tar.xz
Fail properly for failed filter type inferrence.
-rw-r--r--manifests/filter.pp10
1 files changed, 7 insertions, 3 deletions
diff --git a/manifests/filter.pp b/manifests/filter.pp
index 76bdcd3..241bd62 100644
--- a/manifests/filter.pp
+++ b/manifests/filter.pp
@@ -14,9 +14,13 @@ define cgit::filter (
Optional[Variant[String, Array[String]]] $source = undef,
Optional[String] $content = undef,
Hash $file_props = {},
- Enum['lua', 'exec'] $type = stdlib::extname($source) ? {
- '.lua' => 'lua',
- default => 'exec',
+ Enum['lua', 'exec'] $type = $source ? {
+ Undef => fail("Type must be explictly set when source isn't used."),
+ Array => fail("Type can't be inferred from arrays."),
+ String => stdlib::extname($source) ? {
+ '.lua' => 'lua',
+ default => 'exec',
+ },
}
) {
include cgit::filter_setup