def ec2_rsync_download_command(instancewrapper, remote_dir, local_dir, rsync_args='-av', sync_content=False): """ Returns the rsync command used by :func:`ec2_rsync_download`. Takes the same parameters as :func:`ec2_rsync_download`, except for the first parameter, ``instancewrapper``, which is a :class:`Ec2InstanceWrapper` object. """ ssh_uri = instancewrapper.get_ssh_uri() extra_ssh_args = awsfab_settings.EXTRA_SSH_ARGS remote_dir = rsyncformat_path(remote_dir, sync_content) rsync_cmd = ('rsync {rsync_args} -e "ssh {extra_ssh_args}" ' '{ssh_uri}:{remote_dir} {local_dir}').format(**vars()) return rsync_cmd
def ec2_rsync_download_command(instancewrapper, remote_dir, local_dir, rsync_args='-av', sync_content=False): """ Returns the rsync command used by :func:`ec2_rsync_download`. Takes the same parameters as :func:`ec2_rsync_download`, except for the first parameter, ``instancewrapper``, which is a :class:`Ec2InstanceWrapper` object. """ ssh_uri = instancewrapper.get_ssh_uri() key_filename = instancewrapper.get_ssh_key_filename() extra_ssh_args = awsfab_settings.EXTRA_SSH_ARGS remote_dir = rsyncformat_path(remote_dir, sync_content) rsync_cmd = ('rsync {rsync_args} -e "ssh -i {key_filename} {extra_ssh_args}" ' '{ssh_uri}:{remote_dir} {local_dir}').format(**vars()) return rsync_cmd
def test_rsyncformat_path(self): self.assertEquals(rsyncformat_path('/path/to'), '/path/to') self.assertEquals(rsyncformat_path('/path/to', sync_content=True), '/path/to/') self.assertEquals(rsyncformat_path('/path/to'), rsyncformat_path('/path/to', sync_content=False))