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

rsync_project to a different ssh port #44

Closed
bitprophet opened this Issue Aug 19, 2011 · 3 comments

Comments

Projects
None yet
1 participant
@bitprophet
Member

bitprophet commented Aug 19, 2011

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).


Originally submitted by Anonymous () on 2009-08-05 at 11:35am EDT

Relations

  • Duplicated by #186: rsync to non-standard port not working

Closed as Done on 2009-12-13 at 03:51pm EST

@ghost ghost assigned bitprophet Aug 19, 2011

@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Aug 19, 2011

Member

Morgan Goose (goosemo) posted:


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' 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:/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)

on 2009-09-18 at 11:03pm EDT

Member

bitprophet commented Aug 19, 2011

Morgan Goose (goosemo) posted:


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' 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:/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)

on 2009-09-18 at 11:03pm EDT

@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Aug 19, 2011

Member

Morgan Goose (goosemo) posted:


submitted a pull request for this.


on 2009-12-11 at 10:57am EST

Member

bitprophet commented Aug 19, 2011

Morgan Goose (goosemo) posted:


submitted a pull request for this.


on 2009-12-11 at 10:57am EST

@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Aug 19, 2011

Member

Jeff Forcier (bitprophet) posted:


Applied in changeset commit:f27fb518b37d45e40de590f1a0e43b87dc015363.


on 2009-12-13 at 03:51pm EST

Member

bitprophet commented Aug 19, 2011

Jeff Forcier (bitprophet) posted:


Applied in changeset commit:f27fb518b37d45e40de590f1a0e43b87dc015363.


on 2009-12-13 at 03:51pm EST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment