diff options
-rw-r--r-- | manifests/filter.pp | 10 |
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 |