From 84e964bc911c7ca0c859378380ef46403c87e3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ka=E2=80=99imi?= Date: Tue, 15 Oct 2013 14:06:41 +0200 Subject: [PATCH] attribute refactoring --- README.md | 10 +++++----- attributes/default.rb | 10 +++++----- recipes/server.rb | 6 +++--- templates/default/backup.sh.erb | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 954599c..2602d8e 100644 --- a/README.md +++ b/README.md @@ -55,31 +55,31 @@ Attributes id_rsa - ['rdiff-backup']['cron_enable'] + ['rdiff-backup']['cron']['enable'] Boolean whether to setup a cron job for automated backups true - ['rdiff-backup']['cron_email'] + ['rdiff-backup']['cron']['email'] String where to send summary emails nil - ['rdiff-backup']['cron_lockfile'] + ['rdiff-backup']['cron']['lockfile'] String where to write the cron job lockfile /tmp/rdiff-backup.lock - ['rdiff-backup']['autotrim_enable'] + ['rdiff-backup']['autotrim']['enable'] Boolean whether to auto trim backups true - ['rdiff-backup']['autotrim_timespan'] + ['rdiff-backup']['autotrim']['timespan'] String backup retention timespan (in rdiff-backup format) 1y diff --git a/attributes/default.rb b/attributes/default.rb index 064a7b9..ffc89cb 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -10,9 +10,9 @@ default['rdiff-backup']['user'] = "rdiff-backup" default['rdiff-backup']['key'] = "id_rsa" -default['rdiff-backup']['cron_enable'] = true -default['rdiff-backup']['cron_email'] = "it@piratenfraktion-nrw.de" -default['rdiff-backup']['cron_lockfile'] = "/tmp/rdiff-backup.lock" +default['rdiff-backup']['cron']['enable'] = true +default['rdiff-backup']['cron']['email'] = "it@piratenfraktion-nrw.de" +default['rdiff-backup']['cron']['lockfile'] = "/tmp/rdiff-backup.lock" -default['rdiff-backup']['autotrim_enable'] = false -default['rdiff-backup']['autotrim_timespan'] = "1y" +default['rdiff-backup']['autotrim']['enable'] = false +default['rdiff-backup']['autotrim']['timespan'] = "1y" diff --git a/recipes/server.rb b/recipes/server.rb index 2ec4a42..b0ebeb2 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -48,12 +48,12 @@ }) end -if node['rdiff-backup']['cron_enable'] then +if node['rdiff-backup']['cron']['enable'] then cron "backup" do hour "23" minute "0" - if node['rdiff-backup']['cron_email'] then - mailto node['rdiff-backup']['cron_email'] + if node['rdiff-backup']['cron']['email'] then + mailto node['rdiff-backup']['cron']['email'] end user "rdiff-backup" command ": Backup Summary; /etc/rdiff-backup/backup.sh 2>&1" diff --git a/templates/default/backup.sh.erb b/templates/default/backup.sh.erb index f9a112c..c278d80 100644 --- a/templates/default/backup.sh.erb +++ b/templates/default/backup.sh.erb @@ -21,8 +21,8 @@ starting backup of <%= c['fqdn'] %> ssh <%= c['fqdn'] %> 'find <%= node['rdiff-backup']['etc_dir'] %>/pre.d -type f -exec {} \;' rdiff-backup --print-statistics --remote-schema 'ssh -C %s "sudo /usr/bin/rdiff-backup --server --restrict-read-only /"' <% c['dirs'].each do |d,w| %> --include <%= d %> <% end %> --exclude / <%= c['fqdn'] %>::/ <%= node['rdiff-backup']['backup_dir'] %>/<%= c['fqdn'] %> ssh <%= c['fqdn'] %> 'find <%= node['rdiff-backup']['etc_dir'] %>/post.d -type f -exec {} \;' -<% if node['rdiff-backup']['autotrim_enable'] then %> -rdiff-backup --force --remove-older-than <%= node['rdiff-backup']['autotrim_timespan'] %> <%= node['rdiff-backup']['backup_dir'] %>/<%= c['fqdn'] %> +<% if node['rdiff-backup']['autotrim']['enable'] then %> +rdiff-backup --force --remove-older-than <%= node['rdiff-backup']['autotrim']['timespan'] %> <%= node['rdiff-backup']['backup_dir'] %>/<%= c['fqdn'] %> <% end end end %>