diff options
Diffstat (limited to 'manifests/hook.pp')
-rw-r--r-- | manifests/hook.pp | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/manifests/hook.pp b/manifests/hook.pp index c71b6c5..a1fda6e 100644 --- a/manifests/hook.pp +++ b/manifests/hook.pp @@ -1,25 +1,35 @@ +# @summary A Pacman hook + +# @param ensure +# @param priority +# @param description +# @param when +# @param exec +# @param depends +# @param abort_on_fail +# @param needs_targets +# @param trigger define pacman::hook ( + Enum['PreTransation', 'PostTransaction'] $when, + String $exec, + Variant[Pacman::Trigger, Array[Pacman::Trigger, 1]] $trigger, Enum['present', 'absent'] $ensure = 'present', Integer $priority = 50, Optional[String] $description = undef, - Enum['PreTransation', 'PostTransaction'] $when, - String $exec, Optional[Variant[String, Array[String, 1]]] $depends = undef, - Boolean $abortOnFail = false, # only for PreTransation - Boolean $needsTargets = false, - Variant[Pacman::Trigger, Array[Pacman::Trigger, 1]] $trigger, + Boolean $abort_on_fail = false, # only for PreTransation + Boolean $needs_targets = false, ) { + require pacman - require ::pacman - - if ($abortOnFail and $when != 'PreTransation') { - fail('abortOnFail only valid when "when" => "PreTransation"') + if ($abort_on_fail and $when != 'PreTransation') { + fail('abort_on_fail only valid when "when" => "PreTransation"') } # Normalize triggers to list $triggers = ($trigger ? { - Array => $trigger, - default => [$trigger], + Array => $trigger, + default => [$trigger], }).map |$trigger| { # Normalize contents of each trigger, making { @@ -46,17 +56,17 @@ define pacman::hook ( } $str = epp('pacman/hook.epp', { - description => $description, - depends => $depends ? { - Optional => [], - Array => $depends, - default => [$depends], - }, - triggers => $triggers, - exec => $exec, - when => $when, - abortOnFail => $abortOnFail, - needsTargets => $needsTargets, + description => $description, + depends => $depends ? { + Optional => [], + Array => $depends, + default => [$depends], + }, + triggers => $triggers, + exec => $exec, + when => $when, + abort_on_fail => $abort_on_fail, + needs_targets => $needs_targets, }) $chksum = $str.md5() |