Defined Type: selinux::exec_restorecon
- Defined in:
- manifests/exec_restorecon.pp
Summary
A convenience wrapper around a restorecon execOverview
Will execute after all other SELinux changes have been applied, but before Anchor
13 14 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 |
# File 'manifests/exec_restorecon.pp', line 13
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}"]
}
|