From 450474165f5d02c58e1997b4d32d50c5bebaccef Mon Sep 17 00:00:00 2001 From: Rune Juhl Jacobsen Date: Thu, 6 Apr 2017 09:19:17 +0200 Subject: [PATCH 1/2] Fix undefined variables --- manifests/config.pp | 6 +++--- manifests/init.pp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index e5237c2..c208f95 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -12,8 +12,8 @@ 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') $logpath = pick($rsnapshot::logpath, $rsnapshot::params::config_logpath) - $cronfile_prefix_use = pick($rsnapshot::cronfile_prefix_use, $rsnapshot::params::cronfile_prefix_use, false) - $cronfile_prefix = pick($rsnapshot::cronfile_prefix, $rsnapshot::params::cronfile_prefix, '') + $cronfile_prefix_use = pick($rsnapshot::cronfile_prefix_use, $rsnapshot::params::config_cronfile_prefix_use, false) + $cronfile_prefix = pick($rsnapshot::cronfile_prefix, $rsnapshot::params::config_cronfile_prefix, '') # make sure lock path and conf path exist file { $conf_d: ensure => 'directory', @@ -82,7 +82,7 @@ class rsnapshot::config ( $rsync_numtries = pick_undef($hash['rsync_numtries'], $rsnapshot::params::config_rsync_numtries) #$backup_scripts = pick_undef($hash['backup_scripts'], $rsnapshot::params::config_backup_scripts) - $snapshot_dir = "${config_snapshot_root}/${host}" + $snapshot_dir = "${snapshot_root}/${host}" $config = "${conf_d}/${host}.rsnapshot.conf" $lockfile = "${lockpath}/${host}.pid" $logfile = "${logpath}/${host}.log" diff --git a/manifests/init.pp b/manifests/init.pp index f586bcc..5224acc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,6 +18,7 @@ class rsnapshot ( $exclude = $rsnapshot::params::config_exclude, $snapshot_root = $rsnapshot::params::config_snapshot_root, $backup_levels = $rsnapshot::params::config_backup_levels, + $backup_user = $rsnapshot::params::config_backup_user, $cron_service_name = $rsnapshot::params::cron_service_name, $cronfile_prefix = $rsnapshot::params::config_cronfile_prefix, $cronfile_prefix_use = $rsnapshot::params::config_cronfile_prefix_use, From d2cf15621b9c1b2e88685f73c0d6fe974af2b2fc Mon Sep 17 00:00:00 2001 From: Rune Juhl Jacobsen Date: Thu, 6 Apr 2017 09:20:32 +0200 Subject: [PATCH 2/2] Add option to avoid managing cron --- manifests/init.pp | 1 + manifests/params.pp | 1 + manifests/service.pp | 15 +++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 5224acc..031b7a6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,6 +20,7 @@ class rsnapshot ( $backup_levels = $rsnapshot::params::config_backup_levels, $backup_user = $rsnapshot::params::config_backup_user, $cron_service_name = $rsnapshot::params::cron_service_name, + $manage_cron = $rsnapshot::params::manage_cron, $cronfile_prefix = $rsnapshot::params::config_cronfile_prefix, $cronfile_prefix_use = $rsnapshot::params::config_cronfile_prefix_use, $check_mk_job = $rsnapshot::params::config_check_mk_job, diff --git a/manifests/params.pp b/manifests/params.pp index aa483a3..12e54c9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,6 +12,7 @@ class rsnapshot::params { 'Debian' => 'cron', default => '', } + $manage_cron = true $cron_dir = '/etc/cron.d' $config_backup_levels = [ 'daily', 'weekly', 'monthly' ] $config_backup_defaults = true diff --git a/manifests/service.pp b/manifests/service.pp index 9769161..6aed08f 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,10 +1,13 @@ # == Class: rsnapshot::service # -# Reloads cron -class rsnapshot::service { - service { $rsnapshot::cron_service_name: - ensure => running, +# Reloads cron +class rsnapshot::service ( + $manage_cron = $rsnapshot::manage_cron +) { + + if $manage_cron { + service { $rsnapshot::cron_service_name: + ensure => running, + } } - } -