Only re-run 'mkvirtualenv' for backup app, if it doesn't exist

This commit is contained in:
Lance Edgar 2020-09-28 16:02:17 -05:00
parent 775b0eed29
commit a1af0b131e

View file

@ -78,10 +78,10 @@ def deploy_backup_app(deploy, envname, mkvirtualenv=True, user='rattail',
runat = datetime.time(0) # defaults to midnight runat = datetime.time(0) # defaults to midnight
# virtualenv # virtualenv
if mkvirtualenv: envpath = '/srv/envs/{}'.format(envname)
if mkvirtualenv and not exists(envpath):
python.mkvirtualenv(envname, python=python_exe, upgrade_setuptools=False, python.mkvirtualenv(envname, python=python_exe, upgrade_setuptools=False,
runas_user=user) runas_user=user)
envpath = '/srv/envs/{}'.format(envname)
sudo('chown -R {}: {}'.format(user, envpath)) sudo('chown -R {}: {}'.format(user, envpath))
with cd(envpath): with cd(envpath):
mkdir('src', owner=user) mkdir('src', owner=user)