From bf070b511652cf6b7c1840972773ceca745a3d01 Mon Sep 17 00:00:00 2001 From: Andrew Garner Date: Wed, 22 Dec 2010 13:12:59 -0500 Subject: [PATCH] whitespace cleanup --- .../holland/backup/pgdump/base.py | 16 ++++++++-------- .../holland/backup/pgdump/interface.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/holland.backup.pgdump/holland/backup/pgdump/base.py b/plugins/holland.backup.pgdump/holland/backup/pgdump/base.py index d4593394..a600d22d 100644 --- a/plugins/holland.backup.pgdump/holland/backup/pgdump/base.py +++ b/plugins/holland.backup.pgdump/holland/backup/pgdump/base.py @@ -44,13 +44,13 @@ def get_connection(config, db='template1'): cursor.execute("SET ROLE %s" % config["pgdump"]["role"]) except: raise PgError("Failed to set role to " + config["pgdump"]["role"]) - + global ver ver = connection.get_parameter_status('server_version') LOG.info("Server version " + ver) - + return connection - + def get_db_size(dbname, connection): try: cursor = connection.cursor() @@ -110,7 +110,7 @@ def run_pgdump(dbname, output_stream, connection_params, format='custom', env=No stderr.close() if returncode != 0: - raise OSError("%s failed." % + raise OSError("%s failed." % subprocess.list2cmdline(args)) def backup_globals(backup_directory, config, connection_params, env=None): @@ -186,7 +186,7 @@ def pg_extra_options(config): if config['pgdump']['format'] == 'custom': LOG.info("Ignore compression method, since custom format is in use.") config['compression']['method'] = 'none' - args += ['--compress', + args += ['--compress', str(config['compression']['level'])] if config['pgdump']['additional-options']: # XXX: we may want to check these options more carefully and warn as appropriate. @@ -240,13 +240,13 @@ def backup_pgsql(backup_directory, config, databases): LOG.warn("Encoded database %s as filename %s", dbname, dump_name) filename = os.path.join(backup_directory, dump_name + ext_map[format]) - + stream = open_stream(filename, 'w', **config['compression']) backups.append((dbname, stream.name)) - run_pgdump(dbname=dbname, - output_stream=stream, + run_pgdump(dbname=dbname, + output_stream=stream, connection_params=connection_params + extra_options, format=format, env=pgenv) diff --git a/plugins/holland.backup.pgdump/holland/backup/pgdump/interface.py b/plugins/holland.backup.pgdump/holland/backup/pgdump/interface.py index 100ebf1c..0f09039a 100644 --- a/plugins/holland.backup.pgdump/holland/backup/pgdump/interface.py +++ b/plugins/holland.backup.pgdump/holland/backup/pgdump/interface.py @@ -62,11 +62,11 @@ def __init__(self, name, config, target_directory, dry_run=False): self.target_directory = target_directory self.dry_run = dry_run self.config.validate_config(CONFIGSPEC) - + self.connection = get_connection(self.config) self.databases = pg_databases(self.config, self.connection) LOG.info("Got databases: %s" % repr(self.databases)) - + def estimate_backup_size(self): """Estimate the size (in bytes) of the backup this plugin would produce, if run. @@ -74,7 +74,7 @@ def estimate_backup_size(self): :returns: int. size in bytes """ - + totalestimate = 0 for db in self.databases: try: @@ -84,7 +84,7 @@ def estimate_backup_size(self): raise BackupError("Failed to estimate database size for " "%s: %s" % (db, exc)) totalestimate += self._estimate_legacy_size(db) - + return totalestimate def _estimate_legacy_size(self, db):