From 93ac95d58972556d79693a743e294e54a6beddb7 2018-01-15 16:57:47 From: Lance Edgar Date: 2018-01-15 16:57:47 Subject: [PATCH] Revert "Remove a couple steps when cloning Postgres database" This reverts commit 3cfed219b44d1ce66068001304f2c51565676ba7. --- 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):