Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating README with new config style and post processor thoughts.

  • Loading branch information...
commit 20dc9d078aeca68ab776b80f5451ac44231c2272 1 parent 4d1714b
@robhudson authored
Showing with 27 additions and 15 deletions.
  1. +27 −15 README.rst
View
42 README.rst
@@ -6,42 +6,54 @@ Dumpy is a Python database backup script that uses configuration files to
specify databases to backup and options. Backup scripts are classes which
define a `backup` method.
+Each `BackupBase` subclass returns a `NamedTemporaryFile` object. It's up to
+any post processors to use this object in any way (e.g. copy it to another
+location on the file system).
+
+Post processors can be chained and all take the form::
+
+ MyPostProcessor().process(file)
+
+If the post process doesn't alter the file passed in it should return it
+unchanged.
+
Example configuration file
==========================
The following is an idea of what the configuration file, located at
`~/.dumpy.conf` might look like. This is very likely to change::
- [databases]
- mysql = db1, db2
- postgresql = db3
-
- [mysql db1]
+ [database db1]
+ type = mysql
user = db1
- pass = db1
- s3_copy = true
+ password = db1
+ postprocessing = TimestampRename, Bzip, SystemFileCopy, S3Copy
- [mysql db2]
+ [database db2]
+ type = postgresql
user = db2
- pass = db2
-
- [postgresql db3]
- user = db3
- pass = db3
+ password = db2
+ postprocessing = TimestampRename, Bzip, SystemFileCopy
[mysqldump options]
path = /opt/local/lib/mysql5/bin/mysqldump
flags = -Q --opt --compact
- bzip = true
[pgdump options]
path = /opt/local/lib/postgresql83/bin/pg_dump
- [aws_s3]
+ [TimestampRename options]
+ format = %Y%m%d
+
+ [Bzip options]
+ path = /usr/bin/bzip2
+
+ [S3Copy options]
key = key
secret = secret
bucket = bucket
+
Status
======

2 comments on commit 20dc9d0

@clintecker

On my computer at least, I had to specify the format string for the date with escaped %’s like this:

[TimestampRename options]
format = %%Y%%m%%d

else I get errors like the following:

raceback (most recent call last):
  File "dumper.py", line 378, in <module>
    PostProcess(db).process(file)
  File "dumper.py", line 251, in process
    file = globals()[processor](self.db).process(file)
  File "dumper.py", line 289, in process
    self.parse_config()
  File "dumper.py", line 284, in parse_config
    self.format = self._get_option_value(self.config, 'TimestampRename options', 'format')
  File "dumper.py", line 67, in _get_option_value
    return config.get(section, option)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ConfigParser.py", line 525, in get
    return self._interpolate(section, option, value, d)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ConfigParser.py", line 593, in _interpolate
    self._interpolate_some(option, L, rawval, section, vars, 1)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ConfigParser.py", line 634, in _interpolate_some
    "'%%' must be followed by '%%' or '(', found: %r" % (rest,))
ConfigParser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%Y%m%d'
@robhudson
Owner

Yeah, me too. I should fix the README. I’m kinda wondering if instead of a Windows style .ini config, maybe go for YAML or JSON. I kinda like that Python had the ConfigParser builtin, but then again, JSON is also built-in for recent Python versions.

I think sysadmins would be more familiar with .ini style configs, though. Tough call.

Please sign in to comment.
Something went wrong with that request. Please try again.