mirror of
https://gh.wpcy.net/https://github.com/Chassis/puppet-wp.git
synced 2026-05-07 15:58:32 +08:00
30 lines
602 B
Puppet
30 lines
602 B
Puppet
# A class for WP-CLI's cap commands.
|
|
define wp::cap (
|
|
$location,
|
|
$ensure = present,
|
|
$role,
|
|
$cap,
|
|
$grant = true,
|
|
$user = $::wp::user,
|
|
$onlyif = '/usr/bin/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,
|
|
}
|
|
}
|