summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-07-18 22:36:58 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-07-18 22:36:58 +0200
commit739dd06c9c90ce00d1bc7f6dea91aa1723da40d4 (patch)
treedb9e5113509a85bfbaf4aa34a87fe5e1c7caa424
parentConfigure shiori server. (diff)
downloadwebdav_server-739dd06c9c90ce00d1bc7f6dea91aa1723da40d4.tar.gz
webdav_server-739dd06c9c90ce00d1bc7f6dea91aa1723da40d4.tar.xz
Pacman hook paths shouldn't start with '/'.
-rw-r--r--modules/pacman/manifests/hook.pp40
-rw-r--r--modules/profiles/manifests/workstation/archlinux.pp2
2 files changed, 27 insertions, 15 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,
diff --git a/modules/profiles/manifests/workstation/archlinux.pp b/modules/profiles/manifests/workstation/archlinux.pp
index 29ef380..8534da0 100644
--- a/modules/profiles/manifests/workstation/archlinux.pp
+++ b/modules/profiles/manifests/workstation/archlinux.pp
@@ -21,7 +21,7 @@ class profiles::workstation::archlinux {
trigger => {
operation => 'Upgrade',
type => 'Path',
- target => '/usr/lib/systemd/user/*',
+ target => 'usr/lib/systemd/user/*',
},
}
}