Feature #44

rsync_project to a different ssh port

Added by Anonymous 398 days ago. Updated 268 days ago.

Status:Done Start:08/05/2009
Priority:Normal Due date:
Assigned to:avatarJeff Forcier % 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).


Related issues

duplicated by Bug #186 rsync to non-standard port not working Duplicate 07/06/2010

Associated revisions

Revision f27fb518b37d45e40de590f1a0e43b87dc015363
Added by Jeff Forcier 268 days ago

rsync_project now honors SSH port, key filenames.

Fixes #63, fixes #44.

Thanks to both Mich Matuson and Morgan Goose for the initial code contributions for these two features.

Revision 198b16d97c7f6de4adc65deb538d0367bbbc4420
Added by Jeff Forcier 268 days ago

Only use —rsh for non-22 ports in rsync_project.

Re #44

History

Updated by Jeff Forcier 398 days ago

avatar
  • Assigned to set to Jeff Forcier
  • Target version set to 0.9

Updated by Morgan Goose 354 days ago

avatar

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 303 days ago

avatar
  • Target version changed from 0.9 to 0.9.1

Updated by Jeff Forcier 303 days ago

avatar
  • Category set to Contrib

Updated by Jeff Forcier 300 days ago

avatar
  • Target version changed from 0.9.1 to 0.9.2

Updated by Morgan Goose 270 days ago

avatar

submitted a pull request for this.

Updated by Jeff Forcier 268 days ago

avatar
  • Tracker changed from Bug to Feature

Updated by Jeff Forcier 268 days ago

avatar
  • Status changed from New to Done
  • % Done changed from 0 to 100

Also available in: Atom