Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support rsync from remote to local #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MacHu-GWU
Copy link

fix #26

The method is simple. Just add an argument remote_to_local to transfers.rsync function.

If the flag is True, then switch the source and target in the command template. And use keyword arguments instead of positioning argument style.

Solution:

    if host.count(":") > 1:
        # Square brackets are mandatory for IPv6 rsync address,
        # even if port number is not specified
        if remote_to_local:
            cmd = "rsync {options} [{user}@{host}]:{target} {source}"
        else:
            cmd = "rsync {options} {source} [{user}@{host}]:{target}"
    else:
        if remote_to_local:
            cmd = "rsync {options} {user}@{host}:{target} {source}"
        else:
            cmd = "rsync {options} {source} {user}@{host}:{target}"
    cmd = cmd.format(options=options, source=source, user=user, host=host, target=target)
    return c.local(cmd)

@MacHu-GWU MacHu-GWU requested a review from bitprophet January 15, 2020 22:47
@MacHu-GWU
Copy link
Author

@bitprophet Hi, I like your fabric project. I made a little improvement to make patchwork can rsync from remote to local. Please review. Thank you

bpluly added a commit to bpluly/patchwork that referenced this pull request Mar 23, 2023
bpluly added a commit to bpluly/patchwork that referenced this pull request Mar 23, 2023
Issue  support rsync from remote to local fabric#38

Adds the flag remote_to_local to rsync(), defaults to False so that local copy remains the default.

From @https://github.com/MacHu-GWU patch fabric#38 (comment)
@bpluly
Copy link

bpluly commented Mar 24, 2023

In implementing this for my own use I combined it with the work on integrating with Fabric => 3.0.0 using #46 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transfers.rsync don't support rsync from remote to local
2 participants