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

This commit is contained in:
Lance Edgar 2019-09-11 16:58:52 -05:00
parent 2df0cf1b27
commit 5df0e0d16f
2 changed files with 11 additions and 4 deletions

View file

@ -54,6 +54,10 @@ def deploy_backup_app(deploy, envname, mkvirtualenv=True, user='rattail',
Make an app which can run backups for the server. Make an app which can run backups for the server.
""" """
if not config: if not config:
path = '{}/rattail.conf.mako'.format(envname)
if deploy.local_exists(path):
config = path
else:
path = '{}/rattail.conf'.format(envname) path = '{}/rattail.conf'.format(envname)
if deploy.local_exists(path): if deploy.local_exists(path):
config = path config = path
@ -82,7 +86,10 @@ def deploy_backup_app(deploy, envname, mkvirtualenv=True, user='rattail',
# config # config
sudo('bin/rattail make-appdir', user=user) sudo('bin/rattail make-appdir', user=user)
deploy(config, 'app/rattail.conf', owner=user, mode='0600') config_context = {
'user': user,
}
deploy(config, 'app/rattail.conf', owner=user, mode='0600', context=config_context)
sudo('bin/rattail -c app/rattail.conf make-config -T quiet -O app/', user=user) sudo('bin/rattail -c app/rattail.conf make-config -T quiet -O app/', user=user)
sudo('bin/rattail -c app/rattail.conf make-config -T silent -O app/', user=user) sudo('bin/rattail -c app/rattail.conf make-config -T silent -O app/', user=user)

View file

@ -26,7 +26,7 @@ if [ "$(sudo -u ${user} git status --porcelain)" != '' ]; then
exit 1 exit 1
fi fi
sudo -u ${user} git pull $QUIET 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 . $PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
# run backup # run backup