diff --git a/rattail/fablib/postgresql.py b/rattail/fablib/postgresql.py index 01ec74b3346fddad61eed04369bb71db9588cc26..7c0602a665a1fc34e60d1697dbc603abe96c12ba 100644 --- a/rattail/fablib/postgresql.py +++ b/rattail/fablib/postgresql.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8; -*- +# -*- coding: utf-8 -*- ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2018 Lance Edgar +# Copyright © 2010-2017 Lance Edgar # # This file is part of Rattail. # @@ -146,11 +146,13 @@ def download_db(name, destination=None): Download a database from the "current" server. """ if destination is None: - destination = './{}.sql.gz'.format(name) - sudo('sudo -u postgres pg_dump {0} > {0}.sql'.format(name)) - run('gzip --force {}.sql'.format(name)) - get('{}.sql.gz'.format(name), destination) - run('rm {}.sql.gz'.format(name)) + destination = './{0}.sql.gz'.format(name) + run('touch {0}.sql'.format(name)) + run('chmod 0666 {0}.sql'.format(name)) + sudo('sudo -u postgres pg_dump --file={0}.sql {0}'.format(name), shell=False) + run('gzip --force {0}.sql'.format(name)) + get('{0}.sql.gz'.format(name), destination) + run('rm {0}.sql.gz'.format(name)) def clone_db(name, owner, download, user='rattail', force=False, workdir=None):