|
From: <di...@us...> - 2008-07-17 18:52:21
|
Revision: 596
http://safekeep.svn.sourceforge.net/safekeep/?rev=596&view=rev
Author: dimi
Date: 2008-07-17 18:52:09 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
Frank Crawford <fr...@cr...>
* Added options block in backup configuration file.
* Added option to include special-files, i.e. device files, fifos and sockets. Default is to exclude these files.
* Added option to allow inclusion of arbitrary rdiff-backup command.
* Updated relevant documentation.
Modified Paths:
--------------
safekeep/trunk/doc/safekeep.backup.txt
safekeep/trunk/safekeep
Modified: safekeep/trunk/doc/safekeep.backup.txt
===================================================================
--- safekeep/trunk/doc/safekeep.backup.txt 2008-06-27 12:55:26 UTC (rev 595)
+++ safekeep/trunk/doc/safekeep.backup.txt 2008-07-17 18:52:09 UTC (rev 596)
@@ -34,6 +34,10 @@
and for how long (D=days, W=weeks, M=months, or Y=years) -->
<repo path="./data" retention="10D"/>
+ <options>
+ <special-files include="true"/>
+ </options>
+
<!-- settings for database dump and for volume snapshot -->
<setup>
<!-- database type ("postgres" or "mysql"), and database name,
@@ -145,6 +149,20 @@
options don't affect removal of incremental data.
Optional, defaults to empty (unlimited retention).
+/backup/options/special-files/@include::
+ One of "true" or "false". If "true", the dump file will
+ include all special files, including device files, fifo files and
+ socket files.
+ Optional, defaults to "false".
+ *NOTE*: specification of no options is equalent to false, but the
+ inclusion of other options may cause the underlying backup defaults
+ to be use.
+
+/backup/options/rdiff-backup/@append::
+ Append the specified options to the current rdiff-backup run.
+ This is planned to be specific to the current rdiff-backup, and
+ different options will be made available for other backends.
+
/backup/setup/dump/@type::
One of "postgres" or "mysql".
Mandatory for a `<dump>` element.
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2008-06-27 12:55:26 UTC (rev 595)
+++ safekeep/trunk/safekeep 2008-07-17 18:52:09 UTC (rev 596)
@@ -273,6 +273,22 @@
if not dir: dir = id
dir = os.path.join(base_dir, dir)
+ options_els = backup_el.getElementsByTagName('options')
+ options = []
+ if len(options_els) > 0:
+ for options_el in options_els[0].childNodes:
+ if options_el.nodeType != options_el.ELEMENT_NODE:
+ continue
+ option = options_el.nodeName
+ if option in ('special-files', 'rdiff-backup'):
+ if options_el.hasAttributes():
+ for key, value in options_el.attributes.items():
+ options.append({ option : { key : value } })
+ else:
+ raise ConfigException('Option "%s" has no value' % option)
+ else:
+ raise ConfigException('Unknown option "%s"' % option)
+
setup_el = backup_el.getElementsByTagName('setup')
dumps = []
snaps = []
@@ -305,7 +321,7 @@
return { 'id': id, 'host' : host, 'user' : user, 'key_ctrl' : key_ctrl, 'key_data' : key_data,
'dir' : dir, 'retention' : retention, 'dumps' : dumps, 'snaps' : snaps,
- 'cludes' : cludes}
+ 'cludes' : cludes, 'options' : options}
def parse_locs(cfglocs):
cfgfiles = []
@@ -695,6 +711,27 @@
if force:
args.extend(['--force'])
+ options_append = []
+ for option in cfg['options']:
+ if 'special-files' in option:
+ if 'include' in option['special-files']:
+ if 'true'.startswith(option['special-files']['include'].lower()):
+ options_append.extend(['--include-special-files'])
+ else:
+ options_append.extend(['--exclude-special-files', '--include-symbolic-links'])
+
+ # Note if we ever add other backends this section should only be run
+ # when rback-diff is the current option.
+
+ if 'rdiff-backup' in option:
+ if 'append' in option['rdiff-backup']:
+ options_append.extend(option['rdiff-backup']['append'].split(None))
+
+ if options_append:
+ args.extend(options_append)
+ else:
+ args.extend(['--exclude-special-files', '--include-symbolic-links'])
+
#args.extend([ '-v', '6'])
for clude in cfg['cludes']:
opt = '--' + clude['type']
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|