mirror of
https://gh.wpcy.net/https://github.com/Chassis/puppet-wp.git
synced 2026-05-01 21:43:23 +08:00
36 lines
686 B
Puppet
36 lines
686 B
Puppet
# A class for WordPress options.
|
|
define wp::option (
|
|
$location,
|
|
$key = $title,
|
|
$value = undef,
|
|
$ensure = present,
|
|
$format = 'plaintext',
|
|
$autoload = true,
|
|
$user = $::wp::user,
|
|
) {
|
|
include wp::cli
|
|
|
|
case $ensure {
|
|
present: {
|
|
$command = "add ${key} --format=${format} --autoload=${autoload}"
|
|
}
|
|
equal: {
|
|
if $value == undef {
|
|
fail('Option value must be specified')
|
|
}
|
|
$command = "update ${key} ${value}"
|
|
}
|
|
absent: {
|
|
$command = "delete ${key}"
|
|
}
|
|
default: {
|
|
fail('Invalid option operation')
|
|
}
|
|
}
|
|
|
|
wp::command { "${location} option ${command}":
|
|
location => $location,
|
|
command => "option ${command}",
|
|
user => $user,
|
|
}
|
|
}
|