diff --git a/manifests/config.pp b/manifests/config.pp index 0f9edaf..86c5b94 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -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 # them with underscores (issue #2) if $::osfamily == 'Debian' { - $cron_name = regsubst("${host}", '\.', '_') + $cron_name = regsubst($host, '\.', '_', 'G') $cronfile = "${cron_dir}/${rsnapshot_prefix}${cron_name}" } else { @@ -182,7 +186,7 @@ class rsnapshot::config ( # create cron files for each backup level # merge possible cron definitions to one $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", target => $cronfile, order => 1, diff --git a/manifests/init.pp b/manifests/init.pp index 5f17c91..74f970e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,22 +5,23 @@ # === Parameters # class rsnapshot ( - $hosts = $rsnapshot::params::hosts, - $conf_d = $rsnapshot::params::conf_d, - $logpath = $rsnapshot::params::config_logpath, - $lockpath = $rsnapshot::params::config_lockpath, - $default_backup = $rsnapshot::params::config_default_backup, - $package_name = $rsnapshot::params::package_name, - $package_ensure = $rsnapshot::params::package_ensure, - $cron = $rsnapshot::params::cron, - $backup_scripts = $rsnapshot::params::backup_scripts, - $include = $rsnapshot::params::config_include, - $exclude = $rsnapshot::params::config_exclude, - $snapshot_root = $rsnapshot::params::config_snapshot_root, - $backup_levels = $rsnapshot::params::config_backup_levels, - $cron_service_name = $rsnapshot::params::cron_service_name, - $rsnapshot_prefix = $rsnapshot::params::config_rsnapshot_prefix, - $check_mk_job = $rsnapshot::params::config_check_mk_job, + $hosts = $rsnapshot::params::hosts, + $conf_d = $rsnapshot::params::conf_d, + $logpath = $rsnapshot::params::config_logpath, + $lockpath = $rsnapshot::params::config_lockpath, + $default_backup = $rsnapshot::params::config_default_backup, + $package_name = $rsnapshot::params::package_name, + $package_ensure = $rsnapshot::params::package_ensure, + $cron = $rsnapshot::params::cron, + $backup_scripts = $rsnapshot::params::backup_scripts, + $include = $rsnapshot::params::config_include, + $exclude = $rsnapshot::params::config_exclude, + $snapshot_root = $rsnapshot::params::config_snapshot_root, + $backup_levels = $rsnapshot::params::config_backup_levels, + $cron_service_name = $rsnapshot::params::cron_service_name, + $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, ) inherits rsnapshot::params { diff --git a/manifests/params.pp b/manifests/params.pp index 40d5680..61c6a52 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -44,6 +44,7 @@ class rsnapshot::params { $config_loglevel = '4' $config_stop_on_stale_lockfile = undef # bool $config_rsnapshot_prefix = 'rsnapshot_' + $config_rsnapshot_prefix_use = false $config_rsync_short_args = '-az' $config_rsync_long_args = undef # defaults are --delete --numeric-ids --relative --delete-excluded $config_ssh_args = undef