Tweak how backups are configured, to be a tad more generic

This commit is contained in:
Lance Edgar 2019-09-11 17:33:40 -05:00
parent 74308b26a5
commit 9adc5a5b79
2 changed files with 8 additions and 4 deletions

View file

@ -52,11 +52,15 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
Make an app which can run backups for the server.
"""
if not config:
path = '{}/rattail.conf'.format(envname)
path = '{}/rattail.conf.mako'.format(envname)
if deploy.local_exists(path):
config = path
else:
raise ValueError("Must provide config path for backup app")
path = '{}/rattail.conf'.format(envname)
if deploy.local_exists(path):
config = path
else:
raise ValueError("Must provide config path for backup app")
if runat is UNSPECIFIED:
runat = datetime.time(0) # defaults to midnight
@ -78,7 +82,7 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
# config
c.sudo("bash -l -c 'workon {} && cdvirtualenv && rattail make-appdir'".format(envname), user=user)
deploy(c, config, os.path.join(envpath, 'app/rattail.conf'), owner=user, mode='0600', use_sudo=True)
deploy(c, config, os.path.join(envpath, 'app/rattail.conf'), owner=user, mode='0600', use_sudo=True, context=context)
c.sudo("bash -l -c 'workon {} && cdvirtualenv && bin/rattail -c app/rattail.conf make-config -T quiet -O app/'".format(envname), user=user)
c.sudo("bash -l -c 'workon {} && cdvirtualenv && bin/rattail -c app/rattail.conf make-config -T silent -O app/'".format(envname), user=user)

View file

@ -26,7 +26,7 @@ if [ "$(sudo -u ${user} git status --porcelain)" != '' ]; then
exit 1
fi
sudo -u ${user} git pull $QUIET
sudo -u ${user} find . -name '*.pyc' -delete
sudo find . -name '*.pyc' -delete
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
# run backup