Skip to content

support rsync from remote to local - #38

Open
MacHu-GWU wants to merge 3 commits into
fabric:masterfrom
MacHu-GWU:master
Open

support rsync from remote to local #38
MacHu-GWU wants to merge 3 commits into
fabric:masterfrom
MacHu-GWU:master

Conversation

@MacHu-GWU

Copy link
Copy Markdown

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:

ifhost.count(":") >1:
# Square brackets are mandatory for IPv6 rsync address,# even if port number is not specifiedifremote_to_local:
cmd="rsync {options} [{user}@{host}]:{target} {source}"else:
cmd="rsync {options} {source} [{user}@{host}]:{target}"else:
ifremote_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)
returnc.local(cmd)

@MacHu-GWU

Copy link
Copy Markdown
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
Copy Markdown

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

@ferares

Copy link
Copy Markdown

This is a duplicate of PR #29

Sign up for freeto 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

3 participants

@MacHu-GWU@bpluly@ferares