summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-26 16:02:28 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-26 16:02:28 +0200
commitbcced903e6d79c0445c80c362787c81a39dbaf31 (patch)
treef2e59bacb30d03e8b5a7f7573758c98cb6273e57
parentFix permission spelling. (diff)
downloadpuppet-mpd-bcced903e6d79c0445c80c362787c81a39dbaf31.tar.gz
puppet-mpd-bcced903e6d79c0445c80c362787c81a39dbaf31.tar.xz
yes|no => true|false
-rw-r--r--functions/bool_to_yesno.pp5
-rw-r--r--manifests/server.pp20
2 files changed, 18 insertions, 7 deletions
diff --git a/functions/bool_to_yesno.pp b/functions/bool_to_yesno.pp
new file mode 100644
index 0000000..cbae86f
--- /dev/null
+++ b/functions/bool_to_yesno.pp
@@ -0,0 +1,5 @@
+function mpd::bool_to_yesno (
+ Boolean $bool,
+) >> String {
+ if $bool { 'yes' } else { 'no' }
+}
diff --git a/manifests/server.pp b/manifests/server.pp
index 9b18f52..584a11f 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -6,8 +6,8 @@ type Permission = Enum['read', 'add', 'control', 'admin']
class mpd::server (
String $music_directory,
String $mpd_home = '/var/lib/mpd',
- Boolean $follow_outside_symlinks = yes,
- Boolean $follow_inside_symlinks = yes,
+ Boolean $follow_outside_symlinks = true,
+ Boolean $follow_inside_symlinks = true,
String $db_file = "${mpd_home}/database",
String $sticker_file = "${mpd_home}/sticker.sql",
String $log_file = "${mpd_home}/log",
@@ -18,7 +18,7 @@ class mpd::server (
String $bind_to_address = 'any',
Integer $port = 6600,
Enum['default','secure','verbose'] $log_level = default,
- Boolean $zeroconf_enabled = yes,
+ Boolean $zeroconf_enabled = true,
Optional[String] $zeroconf_name,
Optional[Array[Struct[{ name => String, permissions => Array[Permission]}]]] $password,
Optional[Array[Permission]] $default_permissions,
@@ -32,13 +32,13 @@ class mpd::server (
Optional[String] $filesystem_charset,
Optional[String] $id3v1_encoding,
Optional[Boolean] $gapless_mp3_playback,
- Boolean $save_absolute_paths_in_playlists = no,
+ Boolean $save_absolute_paths_in_playlists = true,
Optional[Variant[Enum['none'],
Array[Enum['artist', 'album', 'title',
'track', 'name', 'genre',
'date', 'composer', 'performer',
'comment', 'disc']]]] $metadata_to_use,
- Boolean $auto_update = no,
+ Boolean $auto_update = true,
Optional[Integer] $auto_update_depth,
) {
@@ -88,7 +88,13 @@ class mpd::server (
target => '/etc/mpd.conf',
content => $hash
.filter |$k, $v| { $v != undef }
- .map |$k, $v| { "${k} \"${v}\"\n" }
+ .map |$k, $v| {
+ $val = $v ? {
+ Boolean => mpd::bool_to_yesno($v),
+ default => $v,
+ }
+ "${k} \"${val}\"\n"
+ }
.join()
}
@@ -103,7 +109,7 @@ class mpd::server (
ensure => present,
baseurl => 'https://download1.rpmfusion.org/free/el/updates/7/x86_64',
enabled => true,
- gpgcheck => yes,
+ gpgcheck => true,
gpgkey => 'https://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-free-el-7',
}