From 94945fbc306575f3a855e40db61ec916e1e2e073 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 3 Aug 2023 10:54:33 -0500 Subject: [PATCH] Move sql file to temp path when restoring postgres db otherwise postgres may throw an error, if it can't cd to current workdir --- rattail_fabric2/postgresql.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rattail_fabric2/postgresql.py b/rattail_fabric2/postgresql.py index 382452d..0bcd0fa 100644 --- a/rattail_fabric2/postgresql.py +++ b/rattail_fabric2/postgresql.py @@ -259,7 +259,9 @@ def clone_db(c, name, owner, download, user='rattail', force=False, workdir=None os.chdir(curdir) # restore database on target server - restore_db(c, name, '{}.sql.gz'.format(name)) + filename = f'{name}.sql.gz' + c.sudo(f'mv {filename} /tmp/') + restore_db(c, name, f'/tmp/{filename}') def restore_db(c, name, path):