Defined Type: selinux::exec_restorecon
- Defined in:
- manifests/exec_restorecon.pp
Overview
selinux::exec_restorecon
A convenience wrapper around a restorecon exec
Will execute after all other SELinux changes have been applied, but before Anchor['selinux::end']
15 16 17 18 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 48 |
# File 'manifests/exec_restorecon.pp', line 15
define selinux::exec_restorecon(
Stdlib::Absolutepath $path = $title,
Boolean $refreshonly = true,
Boolean $recurse = true,
Boolean $force = false,
Optional[String] $unless = undef,
Optional[String] $onlyif = undef,
) {
include ::selinux
$opt_recurse = $recurse ? {
true => ' -R',
false => '',
}
$opt_force = $force ? {
true => ' -F',
false => '',
}
$command = "restorecon${opt_force}${opt_recurse}"
exec {"selinux::exec_restorecon ${path}":
path => '/sbin:/usr/sbin',
command => sprintf('%s %s', $command, shellquote($path)),
refreshonly => $refreshonly,
unless => $unless,
onlyif => $onlyif,
before => Anchor['selinux::end'],
}
Anchor['selinux::module post'] -> Exec["selinux::exec_restorecon ${path}"]
}
|