[IMP]RsyncVolumes : add SYNC_EXTRA_PATHES if needed
Managing multiple extra paths to sync (source and dest folder)
This commit is contained in:
parent
9529806dea
commit
570c5e7f9e
@ -12,7 +12,18 @@ def sync():
|
||||
REMOTE_USER = environ.get('REMOTE_USER')
|
||||
REMOTE_PASS = environ.get('REMOTE_PASS')
|
||||
print('Remote host %s configured : will sync with it' % REMOTE_HOST)
|
||||
command = ('sshpass -p %s rsync -av --delete -e '
|
||||
'"ssh -p 23 -o StrictHostKeyChecking=no" '
|
||||
'%s %s@%s:./backups') % (REMOTE_PASS, DEST, REMOTE_USER, REMOTE_HOST)
|
||||
Popen(shplit(command))
|
||||
paths = [DEST]
|
||||
SYNC_EXTRA_PATHES = environ.get('SYNC_EXTRA_PATHES', False)
|
||||
if SYNC_EXTRA_PATHES:
|
||||
paths += SYNC_EXTRA_PATHES.split(',')
|
||||
def run(path):
|
||||
print('Syncing %s...' % path)
|
||||
_paths = path.split(':')
|
||||
lpath = _paths[0]
|
||||
rpath = _paths[1] if len(_paths) > 1 else 'backups'
|
||||
command = ('sshpass -p %s rsync -av --delete -e '
|
||||
'"ssh -p 23 -o StrictHostKeyChecking=no" '
|
||||
'%s %s@%s:./%s') % (REMOTE_PASS, lpath, REMOTE_USER, REMOTE_HOST, rpath)
|
||||
p = Popen(shplit(command))
|
||||
p.communicate()
|
||||
map(run, paths)
|
||||
|
Loading…
Reference in New Issue
Block a user