From f7922a2e4a7f3ae377eda69d80bac558583c8b03 Mon Sep 17 00:00:00 2001 From: Norbert Varzariu Date: Sat, 19 Dec 2015 18:32:24 +0100 Subject: [PATCH] add backup_defaults feature --- manifests/config.pp | 12 ++++++++++-- manifests/params.pp | 3 ++- metadata.json | 3 +-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index d25a283..975bf8e 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -15,11 +15,19 @@ class rsnapshot::config ( file { $lockpath: ensure => 'directory', } - + + notify {"Hosts is: $hosts ": } $hosts.each |String $host, Hash $hash | { $snapshot_root = pick($hash['snapshot_root'], $rsnapshot::params::config_snapshot_root) - $backups = pick($hash['backups'], $rsnapshot::params::config_backups) + $backup = pick($hash['backup'], $rsnapshot::params::config_backup) $backup_user = pick($hash['backup_user'], $rsnapshot::params::config_backup_user) + $backup_defaults = pick($hash['backup_defaults'], $rsnapshot::params::config_backup_defaults) + if $backup_defaults { + $backups = merge($backup, $rsnapshot::params::config_backup) + } else { + $backups = $backup + } + $cmd_cp = pick($hash['cmd_cp'], $rsnapshot::params::config_cmd_cp) $cmd_rm = pick($hash['cmd_rm'], $rsnapshot::params::config_cmd_rm) $cmd_rsync = pick($hash['cmd_rsync'], $rsnapshot::params::config_cmd_rsync) diff --git a/manifests/params.pp b/manifests/params.pp index 334349d..90f0ebc 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -7,6 +7,7 @@ class rsnapshot::params { $config_backup_user = 'root' $package_name = 'rsnapshot' $package_ensure = 'present' + $config_backup_defaults = true $config_version = '1.2' $config_cmd_cp = '/bin/cp' $config_cmd_rm = '/bin/rm' @@ -53,7 +54,7 @@ class rsnapshot::params { $config_sync_first = false $config_rsync_numtries = 1 $config_use_lazy_deletes = false - $config_backups = { + $config_backup = { '/etc' => './', '/home' => './', } diff --git a/metadata.json b/metadata.json index 1e3eaf4..1d1a279 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,6 @@ { "name": "puppet", "version_requirement": ">= 3.0.0" } ], "dependencies": [ - { "name": "puppetlabs-stdlib","version_range": ">= 1.0.0" - } + { "name": "puppetlabs-stdlib","version_range": ">= 1.0.0" } ] }