Feature #44
rsync_project to a different ssh port
| Status: | Done | Start: | 08/05/2009 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | Contrib | |||
| Target version: | 0.9.2 | |||
Description
When not using the standard port 22 rsync_project failes to detect the port setting used in the env.hosts variable (example.com:443).
Associated revisions
Revision f27fb518b37d45e40de590f1a0e43b87dc015363
rsync_project now honors SSH port, key filenames.
Thanks to both Mich Matuson and Morgan Goose for the initial code contributions for these two features.
Revision 198b16d97c7f6de4adc65deb538d0367bbbc4420
Only use —rsh for non-22 ports in rsync_project.
Re #44
History
Updated by Morgan Goose 354 days ago
I think this can be solved by changing how the rsync command is formulated. Right now if you had: { user:‘goose’, host:‘temp.com’, dest:‘test_dir’, source:‘test’,}
you'd get an rsync command like this:
rsync -pthrvz test goose@temp.com:test_dir
where if one would want to change the port you could either use:
--rsh='ssh -p<port num>' like for the rsync with keys patch.
or reformulate the command to use the rsync:// protocol bits like:
rsync -pthrvz test rsync://goose@temp.com:<port num>/test_dir
The second option though requires there to be an rsync daemon running on the server, and looking at the ticket it seems that the implied use is to use the ssh connection just on a non-standard port.
So I've made an addition to the rsh flag patch where the rsh commands are now in their own string that is fed into the rsync command string. I've yet to test it only because I have to setup something to recieve on a non-standard port. Once I do that I’ll submit a pull request.
The change to the rsync_project additions would be:
port_string = ""
key_string = ""
rsh_string = ""
if env.key_filename:
if type(env.key_filename) == str:
key_string = "-i" + env.key_filename
elif type(env.key_filename) == list:
key_string = "-i" + " -i ".join(env_key_filename)
port_string = "-p%s" % env.port if env.port else ""
if key_string or port_string:
rsh_string = " --rsh='ssh %s %s'" % (
port_string, key_string)
# Get local directory
if local_dir is None:
local_dir = '../' + getcwd().split(sep)[-1]
# Create and run final command string
cmd = "rsync %s %s %s %s@%s:%s" % (options, rsh_string, local_dir, env.user,
env.host, remote_dir)
Updated by Jeff Forcier 268 days ago
- Status changed from New to Done
- % Done changed from 0 to 100
Applied in changeset f27fb518b37d45e40de590f1a0e43b87dc015363.
Also available in: Atom