Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
whitespace cleanup
  • Loading branch information
abg committed Dec 22, 2010
1 parent 44c8bcd commit bf070b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions plugins/holland.backup.pgdump/holland/backup/pgdump/base.py
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
Expand Up @@ -62,19 +62,19 @@ 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.
:returns: int. size in bytes
"""

totalestimate = 0
for db in self.databases:
try:
Expand All @@ -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):
Expand Down

0 comments on commit bf070b5

Please sign in to comment.