1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-11-14 01:00:34 +00:00

use prefix not by default

This commit is contained in:
André Bauer 2017-04-01 23:27:18 +02:00
parent 7dd4b98f1a
commit 6e7d8e02f3
3 changed files with 24 additions and 18 deletions

View File

@ -162,10 +162,14 @@ class rsnapshot::config (
} }
} }
if rsnapshot_prefix_use == false {
$rsnapshot_prefix = ''
}
# cron on Debian seems to ignore files that have dots in their name; replace # cron on Debian seems to ignore files that have dots in their name; replace
# them with underscores (issue #2) # them with underscores (issue #2)
if $::osfamily == 'Debian' { if $::osfamily == 'Debian' {
$cron_name = regsubst("${host}", '\.', '_') $cron_name = regsubst($host, '\.', '_', 'G')
$cronfile = "${cron_dir}/${rsnapshot_prefix}${cron_name}" $cronfile = "${cron_dir}/${rsnapshot_prefix}${cron_name}"
} }
else { else {
@ -182,7 +186,7 @@ class rsnapshot::config (
# create cron files for each backup level # create cron files for each backup level
# merge possible cron definitions to one # merge possible cron definitions to one
$real_cron = deep_merge($rsnapshot::params::cron, $rsnapshot::cron, $hash[cron]) $real_cron = deep_merge($rsnapshot::params::cron, $rsnapshot::cron, $hash[cron])
concat::fragment { "mailto for $host": concat::fragment { "mailto for ${host}":
content => "#This file is managed by puppet\nMAILTO=${real_cron[mailto]}\n\n", content => "#This file is managed by puppet\nMAILTO=${real_cron[mailto]}\n\n",
target => $cronfile, target => $cronfile,
order => 1, order => 1,

View File

@ -20,6 +20,7 @@ class rsnapshot (
$backup_levels = $rsnapshot::params::config_backup_levels, $backup_levels = $rsnapshot::params::config_backup_levels,
$cron_service_name = $rsnapshot::params::cron_service_name, $cron_service_name = $rsnapshot::params::cron_service_name,
$rsnapshot_prefix = $rsnapshot::params::config_rsnapshot_prefix, $rsnapshot_prefix = $rsnapshot::params::config_rsnapshot_prefix,
$rsnapshot_prefix_use = $rsnapshot::params::config_rsnapshot_prefix_use,
$check_mk_job = $rsnapshot::params::config_check_mk_job, $check_mk_job = $rsnapshot::params::config_check_mk_job,
) inherits rsnapshot::params { ) inherits rsnapshot::params {

View File

@ -44,6 +44,7 @@ class rsnapshot::params {
$config_loglevel = '4' $config_loglevel = '4'
$config_stop_on_stale_lockfile = undef # bool $config_stop_on_stale_lockfile = undef # bool
$config_rsnapshot_prefix = 'rsnapshot_' $config_rsnapshot_prefix = 'rsnapshot_'
$config_rsnapshot_prefix_use = false
$config_rsync_short_args = '-az' $config_rsync_short_args = '-az'
$config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded $config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded
$config_ssh_args = undef $config_ssh_args = undef