1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-12-16 09:40:35 +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

@ -5,22 +5,23 @@
# === Parameters # === Parameters
# #
class rsnapshot ( class rsnapshot (
$hosts = $rsnapshot::params::hosts, $hosts = $rsnapshot::params::hosts,
$conf_d = $rsnapshot::params::conf_d, $conf_d = $rsnapshot::params::conf_d,
$logpath = $rsnapshot::params::config_logpath, $logpath = $rsnapshot::params::config_logpath,
$lockpath = $rsnapshot::params::config_lockpath, $lockpath = $rsnapshot::params::config_lockpath,
$default_backup = $rsnapshot::params::config_default_backup, $default_backup = $rsnapshot::params::config_default_backup,
$package_name = $rsnapshot::params::package_name, $package_name = $rsnapshot::params::package_name,
$package_ensure = $rsnapshot::params::package_ensure, $package_ensure = $rsnapshot::params::package_ensure,
$cron = $rsnapshot::params::cron, $cron = $rsnapshot::params::cron,
$backup_scripts = $rsnapshot::params::backup_scripts, $backup_scripts = $rsnapshot::params::backup_scripts,
$include = $rsnapshot::params::config_include, $include = $rsnapshot::params::config_include,
$exclude = $rsnapshot::params::config_exclude, $exclude = $rsnapshot::params::config_exclude,
$snapshot_root = $rsnapshot::params::config_snapshot_root, $snapshot_root = $rsnapshot::params::config_snapshot_root,
$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,
$check_mk_job = $rsnapshot::params::config_check_mk_job, $rsnapshot_prefix_use = $rsnapshot::params::config_rsnapshot_prefix_use,
$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