diff --git a/manifests/config/agent.pp b/manifests/config/agent.pp index 1344e65..206c3df 100644 --- a/manifests/config/agent.pp +++ b/manifests/config/agent.pp @@ -1,13 +1,13 @@ define puppet::config::agent ( - $value, - $key = $name, - $joiner = ',' + Variant[Array[String], Boolean, String, Integer] $value, + String $key = $name, + String $joiner = ',' ) { puppet::config::entry{"agent_${name}": key => $key, value => $value, joiner => $joiner, section => 'agent', sectionorder => 2, } } diff --git a/manifests/config/entry.pp b/manifests/config/entry.pp index c4901f3..50d3bb6 100644 --- a/manifests/config/entry.pp +++ b/manifests/config/entry.pp @@ -1,39 +1,39 @@ define puppet::config::entry ( - $key, - $value, - $section, - $sectionorder = 5, - $joiner = ',', + String $key, + Variant[Array[String], Boolean, String, Integer] $value, + String $section, + Variant[Integer[0], String] $sectionorder = 5, + String $joiner = ',', ) { if ($value =~ Array) { $_value = join(flatten($value), $joiner) } elsif ($value =~ Boolean) { $_value = bool2str($value) } else { $_value = $value } # note the spaces at he end of the 'order' parameters, # they make sure that '1_main ' is ordered before '1_main_*' ensure_resource('concat::fragment', "puppet.conf_${section}", { target => "${::puppet::dir}/puppet.conf", content => "\n\n[${section}]", order => "${sectionorder}_${section} ", }) # this adds the '$key =' for the first value, # otherwise it just appends it with the joiner to separate it from the previous value. if (!defined(Concat::Fragment["puppet.conf_${section}_${key}"])){ concat::fragment{"puppet.conf_${section}_${key}": target => "${::puppet::dir}/puppet.conf", content => "\n ${key} = ${_value}", order => "${sectionorder}_${section}_${key} ", } } else { concat::fragment{"puppet.conf_${section}_${key}_${name}": target => "${::puppet::dir}/puppet.conf", content => "${joiner}${_value}", order => "${sectionorder}_${section}_${key}_${name} ", } } } diff --git a/manifests/config/main.pp b/manifests/config/main.pp index 2828a2a..0770135 100644 --- a/manifests/config/main.pp +++ b/manifests/config/main.pp @@ -1,13 +1,13 @@ define puppet::config::main ( - $value, - $key = $name, - $joiner = ',' + Variant[Array[String], Boolean, String, Integer] $value, + String $key = $name, + String $joiner = ',' ) { puppet::config::entry{"main${name}": key => $key, value => $value, joiner => $joiner, section => 'main', sectionorder => 1, } } diff --git a/manifests/config/master.pp b/manifests/config/master.pp index 25b22af..27570c5 100644 --- a/manifests/config/master.pp +++ b/manifests/config/master.pp @@ -1,13 +1,13 @@ define puppet::config::master ( - $value, - $key = $name, - $joiner = ',' + Variant[Array[String], Boolean, String, Integer] $value, + String $key = $name, + String $joiner = ',' ) { puppet::config::entry{"master_${name}": key => $key, value => $value, joiner => $joiner, section => 'master', sectionorder => 3, } }