diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-07-18 22:36:58 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-07-18 22:36:58 +0200 |
commit | 739dd06c9c90ce00d1bc7f6dea91aa1723da40d4 (patch) | |
tree | db9e5113509a85bfbaf4aa34a87fe5e1c7caa424 /modules/pacman/manifests/hook.pp | |
parent | Configure shiori server. (diff) | |
download | webdav_server-739dd06c9c90ce00d1bc7f6dea91aa1723da40d4.tar.gz webdav_server-739dd06c9c90ce00d1bc7f6dea91aa1723da40d4.tar.xz |
Pacman hook paths shouldn't start with '/'.
Diffstat (limited to '')
-rw-r--r-- | modules/pacman/manifests/hook.pp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/modules/pacman/manifests/hook.pp b/modules/pacman/manifests/hook.pp index 940ae5f..f8478e6 100644 --- a/modules/pacman/manifests/hook.pp +++ b/modules/pacman/manifests/hook.pp @@ -25,9 +25,33 @@ define pacman::hook ( fail('abortOnFail only valid when "when" => "PreTransation"') } - $triggers = $trigger ? { + # Normalize triggers to list + $triggers = ($trigger ? { Array => $trigger, default => [$trigger], + }).map |$trigger| { + # Normalize contents of each trigger, making + { + type => $trigger['type'], + operation => $trigger['operation'] ? { + Array => $trigger['operation'], + default => [$trigger['operation']], + }, + target => $trigger['target'] ? { + Array => $trigger['target'], + default => [$trigger['target']], + } + } + } + + $triggers.each |$trigger| { + if $trigger['type'] == 'Path' { + $trigger['target'].each |$target| { + if $target[0] == '/' { + fail("Target paths shouldn't start with '/' ${target} in trigger ${name}") + } + } + } } $str = epp('pacman/hook.epp', { @@ -37,19 +61,7 @@ define pacman::hook ( Array => $depends, default => [$depends], }, - triggers => $triggers.map |$trigger| { - { - type => $trigger['type'], - operation => $trigger['operation'] ? { - Array => $trigger['operation'], - default => [$trigger['operation']], - }, - target => $trigger['target'] ? { - Array => $trigger['target'], - default => [$trigger['target']], - } - } - }, + triggers => $triggers, exec => $exec, when => $when, abortOnFail => $abortOnFail, |