19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'manifests/post_transaction_action.pp', line 19
define yum::post_transaction_action (
Variant[Enum['*'],Yum::RpmNameGlob,Stdlib::Unixpath] $key,
String[1] $command,
Enum['install', 'update', 'remove', 'any', 'in', 'out'] $state = 'any',
String[1] $action = $title,
) {
#
# The valid Enum is different for yum and dnf based systems.
#
if $facts['package_provider'] == 'yum' {
assert_type(Enum['install','update','remove','any'],$state) |$expected, $actual| {
fail("The state parameter on ${facts['package_provider']} based systems should be \'${expected}\' and not \'${actual}\'")
}
} else {
assert_type(Enum['in', 'out', 'any'],$state) |$expected, $actual| {
fail("The state parameter on ${facts['package_provider']} based systems should be \'${expected}\' and not \'${actual}\'")
}
}
require yum::plugin::post_transaction_actions
if $yum::plugin::post_transaction_actions::ensure == 'present' {
concat::fragment { "post_trans_${action}":
target => 'puppet_actions',
content => "# Action name: ${action}\n${key}:${state}:${command}\n\n",
order => '10',
}
}
}
|