diff --git a/TODO b/TODO index 8e6d55c..b08abee 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ validate for puppet 3 => impossible, misses the .each function -Fix Documentation + +only create exclude and/or include files if actually exclude/include are given diff --git a/manifests/config.pp b/manifests/config.pp index e31184b..6223b20 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -108,9 +108,20 @@ class rsnapshot::config ( $use_lazy_deletes_num = bool2num($use_lazy_deletes) } - file { $exclude_file: - ensure => 'file', + if $include != '' { + file { $include_file: + ensure => 'file', + content => template('rsnapshot/include.erb'), + } } + + if $exclude != '' { + file { $exclude_file: + ensure => 'file', + content => template('rsnapshot/exclude.erb'), + } + } + file { $config: content => template('rsnapshot/rsnapshot.erb'), } diff --git a/metadata.json b/metadata.json index 263bc8f..4053890 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "loomsen-rsnapshot", - "version": "0.2.2", + "version": "0.3.0", "author": "loomsen", "summary": "Configures rsnapshot.", "license": "Apache-2.0", diff --git a/templates/rsnapshot.erb b/templates/rsnapshot.erb index 62ceadc..8b088ad 100644 --- a/templates/rsnapshot.erb +++ b/templates/rsnapshot.erb @@ -82,25 +82,19 @@ ssh_args <%= @ssh_args %> <% if @du_args != '' -%> du_args <%= @du_args %> <% end -%> -<% if @one_fs != '' %> +<% if @one_fs != '' -%> one_fs <%= @one_fs_num %> <% end -%> -<% if @include != '' %> -<% @include.each do |pattern| -%> -include <%= pattern %> -<% end -%> -<%end-%> -<% if @exclude != '' %> -<% @exclude.each do |pattern| -%> -exclude <%= pattern %> -<% end -%> -<%end-%> +<% if @include != '' -%> <% if @include_file != '' -%> include_file <%= @include_file %> <% end -%> +<% end -%> +<% if @exclude != '' -%> <% if @exclude_file != '' -%> exclude_file <%= @exclude_file %> <% end -%> +<% end -%> <% if @link_dest != '' -%> link_dest <%= @link_dest_num %> <% end -%>