Port logic for deploying a "backup" app

This commit is contained in:
Lance Edgar 2019-01-06 14:14:47 -06:00
parent c2fe7586da
commit bd4768839a
7 changed files with 196 additions and 0 deletions

View file

@ -35,6 +35,9 @@ import six
from mako.template import Template
UNSPECIFIED = object()
def is_link(c, path, use_sudo=False):
"""
Return True if the given path is a symlink on the current remote host.
@ -186,6 +189,9 @@ class Deployer(object):
def full_path(self, local_path):
return '{}/{}'.format(self.deploy_path, local_path)
def local_exists(self, local_path):
return os.path.exists(self.full_path(local_path))
def deploy(self, c, local_path, remote_path, context={}, **kwargs):
local_path = self.full_path(local_path)
if local_path.endswith('.template'):
@ -204,6 +210,10 @@ class Deployer(object):
kwargs['use_sudo'] = True
deploy_site(c, self, local_path, name, **kwargs)
def backup_app(self, c, envname='backup', *args, **kwargs):
from rattail_fabric2.backup import deploy_backup_app
deploy_backup_app(c, self, envname, *args, **kwargs)
def make_deploy(deploy_path, last_segment='deploy'):
"""