Merge pull request #7 from dgarbus/do_not_require_template_file

Do not require that a template file is passed to consul_template::watch
This commit is contained in:
gdhbashton 2015-05-02 02:32:20 +01:00
Родитель 251a5a3f06 65fe9cd053
Коммит 43af6c0a3d
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -4,17 +4,19 @@
# This is a single instance of a configuration file to watch
# for changes in Consul and update the local file
define consul_template::watch (
$template,
$template = undef,
$destination,
$command,
) {
include consul_template
file { "${consul_template::config_dir}/${name}.ctmpl":
ensure => present,
content => template($template),
} ->
if $template != undef {
file { "${consul_template::config_dir}/${name}.ctmpl":
ensure => present,
content => template($template),
before => Concat::Fragment["${name}.ctmpl"],
}
}
concat::fragment { "${name}.ctmpl":
target => 'consul-template/config.json',
content => "template {\n source = \"${consul_template::config_dir}/${name}.ctmpl\"\n destination = \"${destination}\"\n command = \"${command}\"\n}\n\n",