Correction script fabric pour cloner la base

This commit is contained in:
Claude Paroz 2021-02-01 18:13:28 +01:00
parent 3c6d05e0e3
commit 77f4c5f832

6
scripts/fabfile.py vendored
View file

@ -27,8 +27,8 @@ def clone_remote_db(conn):
if is_sqlite:
return os.path.exists(db_name)
else: # Assume postgres
db_list = local.run('psql --list', capture=True)
return (' ' + db_name + ' ') in db_list
res = local.run('psql --list', hide='stdout')
return db_name in res.stdout.split()
if exist_local_db():
rep = input('A local database named "%s" already exists. Overwrite? (y/n)' % db_name)
@ -44,7 +44,7 @@ def clone_remote_db(conn):
with conn.cd(APP_DIR):
with conn.prefix('source %s' % VIRTUALENV_DIR):
conn.run('python manage.py dumpdata --natural-foreign --indent 1 -e auth.Permission auth stages candidats > epcstages.json')
conn.get('epcstages.json', '.')
conn.get('/var/www/epcstages/epcstages.json', None)
if not is_sqlite:
local.run(