puppet-wp/manifests/cap.pp
2019-09-17 19:00:27 +10:00

30 lines
617 B
Puppet

# A class for WP-CLI's cap commands.
define wp::cap (
$role,
$cap,
$location,
$ensure = present,
$grant = true,
$user = $::wp::user,
$onlyif = "${wp::params::bin_path}/wp core is-installed",
) {
include wp::cli
case $ensure {
present: {
$command = "add ${role} ${cap} --grant=${grant}"
}
absent: {
$command = "remove ${role} ${cap}"
}
default: {
fail( 'Invalid attribute for wp::cap' )
}
}
wp::command { "${location} cap ${command}":
location => $location,
command => "cap ${command}",
user => $user,
onlyif => $onlyif,
}
}