From d4cd5282f79b4b5920650e6a5ad1d71ec2355e30 Mon Sep 17 00:00:00 2001 From: Norbert Varzariu Date: Thu, 21 Jan 2016 16:11:56 +0100 Subject: [PATCH] quick fixes --- manifests/config.pp | 8 ++++++-- templates/rsnapshot.erb | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 210fb84..80ee50d 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -12,6 +12,7 @@ class rsnapshot::config ( $conf_d = pick($rsnapshot::conf_d, $rsnapshot::params::conf_d, '/etc/rsnapshot') $snapshot_root = pick($hosts['snapshot_root'], $rsnapshot::snapshot_root, '/backup') $default_cron = assert_empty_hash($::rsnapshot::cron) + $logpath = pick($rsnapshot::logpath, $rsnapshot::params::config_logpath) # make sure lock path and conf path exist file { $conf_d: ensure => 'directory', @@ -25,6 +26,10 @@ class rsnapshot::config ( file { $snapshot_root: ensure => 'directory', } + file { $logpath: + ensure => directory, + } + # custom function, if only a hostname is given as a param, this is an empty hash # the next loop would break as puppet does not allow to reassign variables # the function checks $hosts for elements like: @@ -56,7 +61,6 @@ class rsnapshot::config ( $linux_lvm_vgpath = pick_undef($hash['linux_lvm_vgpath'], $rsnapshot::params::config_linux_lvm_vgpath) $linux_lvm_mountpath = pick_undef($hash['linux_lvm_mountpath'], $rsnapshot::params::config_linux_lvm_mountpath) $no_create_root = pick_undef($hash['no_create_root'], $rsnapshot::params::config_no_create_root) - $logpath = pick($hash['logpath'], $rsnapshot::logpath, $rsnapshot::params::config_logpath) $verbose = pick($hash['verbose'], $rsnapshot::params::config_verbose) $loglevel = pick($hash['loglevel'], $rsnapshot::params::config_loglevel) $stop_on_stale_lockfile = pick_undef($hash['stop_on_stale_lockfile'], $rsnapshot::params::config_stop_on_stale_lockfile) @@ -117,7 +121,7 @@ class rsnapshot::config ( } } - $real_exclude = $rsnapshot::exclude + $exclude + $real_exclude = $rsnapshot::exclude + $exclude unless empty($real_exclude) { file { $exclude_file: ensure => 'file', diff --git a/templates/rsnapshot.erb b/templates/rsnapshot.erb index f6d6868..730c01d 100644 --- a/templates/rsnapshot.erb +++ b/templates/rsnapshot.erb @@ -85,12 +85,12 @@ du_args <%= @du_args %> <% if @one_fs != '' -%> one_fs <%= @one_fs_num %> <% end -%> -<% if @include != '' -%> +<% if not @real_include.empty? -%> <% if @include_file != '' -%> include_file <%= @include_file %> <% end -%> <% end -%> -<% if @exclude != '' -%> +<% if not @real_exclude.empty? -%> <% if @exclude_file != '' -%> exclude_file <%= @exclude_file %> <% end -%>