From 8e9a685006590e5dccd327aba0044f82159489d1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 8 Aug 2023 19:19:33 -0500 Subject: [PATCH] Try again, to move postgres dump file to /tmp before restoring so the postgres can cd to current workdir without error..fingers crossed this doesn't break anything else again --- rattail_fabric2/postgresql.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rattail_fabric2/postgresql.py b/rattail_fabric2/postgresql.py index 382452d..f2d8440 100644 --- a/rattail_fabric2/postgresql.py +++ b/rattail_fabric2/postgresql.py @@ -259,7 +259,12 @@ 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)) + # TODO: first tried c.sudo('mv ...') but that did not work for the "typical" + # scenario of connecting as rattail@server to obtain db dump, since the dump + # cmd is normally carved out via sudoers config, but 'sudo mv ..' is not + filename = f'{name}.sql.gz' + c.run(f'mv {filename} /tmp/') + restore_db(c, name, f'/tmp/{filename}') def restore_db(c, name, path):