1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-09-20 01:10:35 +00:00

fix crontabs with dots on debian & added rsnapshot_prefix var

This commit is contained in:
André Bauer 2017-02-27 11:58:18 +01:00
parent 59cdc23ca1
commit 90ee92acb8
3 changed files with 22 additions and 7 deletions

View File

@ -162,7 +162,21 @@ class rsnapshot::config (
} }
} }
$cronfile = "${cron_dir}/${host}" # cron on Debian seems to ignore files that have dots in their name; replace
# them with underscores (issue #2)
if $::osfamily == 'Debian' {
$cron_name = regsubst("${host}", '\.', '_')
$cronfile = "${cron_dir}/${rsnapshot_prefix}${cron_name}"
}
else {
$cronfile = "${cron_dir}/${rsnapshot_prefix}${host}"
}
# Make sure old cron files without rsnapshot_prefix are removed
file { "${cron_dir}/${host}":
ensure => absent,
}
concat { $cronfile: concat { $cronfile:
} }
# create cron files for each backup level # create cron files for each backup level
@ -190,4 +204,3 @@ class rsnapshot::config (
} }
} }
} }

View File

@ -19,6 +19,8 @@ class rsnapshot (
$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,
) inherits rsnapshot::params { ) inherits rsnapshot::params {
$default_backup_scripts = $rsnapshot::params::backup_scripts + $backup_scripts $default_backup_scripts = $rsnapshot::params::backup_scripts + $backup_scripts
@ -32,4 +34,3 @@ class rsnapshot (
contain '::rsnapshot::service' contain '::rsnapshot::service'
} }
} }

View File

@ -42,6 +42,7 @@ class rsnapshot::params {
$config_verbose = '2' $config_verbose = '2'
$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_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