Skip to content

Commit

Permalink
attribute refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kaimi committed Oct 15, 2013
1 parent d4b7805 commit 84e964b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,31 @@ Attributes
<td><tt>id_rsa</tt></td>
</tr>
<tr>
<td><tt>['rdiff-backup']['cron_enable']</tt></td>
<td><tt>['rdiff-backup']['cron']['enable']</tt></td>
<td>Boolean</td>
<td>whether to setup a cron job for automated backups</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['rdiff-backup']['cron_email']</tt></td>
<td><tt>['rdiff-backup']['cron']['email']</tt></td>
<td>String</td>
<td>where to send summary emails</td>
<td><tt>nil</tt></td>
</tr>
<tr>
<td><tt>['rdiff-backup']['cron_lockfile']</tt></td>
<td><tt>['rdiff-backup']['cron']['lockfile']</tt></td>
<td>String</td>
<td>where to write the cron job lockfile</td>
<td><tt>/tmp/rdiff-backup.lock</tt></td>
</tr>
<tr>
<td><tt>['rdiff-backup']['autotrim_enable']</tt></td>
<td><tt>['rdiff-backup']['autotrim']['enable']</tt></td>
<td>Boolean</td>
<td>whether to auto trim backups</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['rdiff-backup']['autotrim_timespan']</tt></td>
<td><tt>['rdiff-backup']['autotrim']['timespan']</tt></td>
<td>String</td>
<td>backup retention timespan (in rdiff-backup format)</td>
<td><tt>1y</tt></td>
Expand Down
10 changes: 5 additions & 5 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = "[email protected]"
default['rdiff-backup']['cron_lockfile'] = "/tmp/rdiff-backup.lock"
default['rdiff-backup']['cron']['enable'] = true
default['rdiff-backup']['cron']['email'] = "[email protected]"
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"
6 changes: 3 additions & 3 deletions recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions templates/default/backup.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down

0 comments on commit 84e964b

Please sign in to comment.