def _sync(self, src, dest): src = os.path.expanduser(src) rsync = bake(sh.rsync).bake( '--exclude', '.git', '--exclude', 'tests', '--exclude', 'test', verbose=True, recursive=True, compress=True, progress=True, delete=True, stats=True, rsync_path='sudo rsync', rsh='ssh -i {} -o ControlPath={}'.format(self.key, self.control_path)) rsync('{}/'.format(src), '{}:{}'.format(self.hoststring, dest)).wait()
def __init__(self, source_root): handler_configuration = cosmo.handler_configuration self.ip = handler_configuration['manager_ip'] self.user = handler_configuration['manager_user'] self.hoststring = '{}@{}'.format(self.user, self.ip) self.key = os.path.expanduser(handler_configuration['manager_key']) self.control_path = cosmo.dir / 'control' self.source_root = source_root self.ssh = bake(sh.ssh).bake( '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-i', self.key, '-o', 'ControlPath={}'.format(self.control_path)) self.ssh('-nNf', '-o', 'ControlMaster=yes', self.hoststring) # Unfortunate sleep here. # It blocks if we do .wait() in the previous # ssh command which I can't figure out why time.sleep(3)
def _sync(self, src, dest): src = os.path.expanduser(src) rsync = bake(sh.rsync).bake('--exclude', '.git', '--exclude', 'tests', '--exclude', 'test', verbose=True, recursive=True, compress=True, progress=True, delete=True, stats=True, rsync_path='sudo rsync', rsh='ssh -i {} -o ControlPath={}'.format( self.key, self.control_path)) rsync('{}/'.format(src), '{}:{}'.format(self.hoststring, dest)).wait()