Skip to content

transfers.rsync ignores ssh agent and always asks for key password #16

@max-arnold

Description

@max-arnold

Thanks for making patchwork compatible with Python 3! Trying to port one small project to Fabric v2:

from invoke import task
from patchwork.transfers import rsync

def get_proj_path():
    from fabric.main import program
    return program.collection.loaded_from

@task
def upload(c):
    rsync(c, '%s/configs' % get_proj_path(), '/tmp')
> /Users/user/.virtualenvs/test1/lib/python3.6/site-packages/patchwork/transfers.py(131)rsync()
    129     cmd = cmd.format(options, source, user, host, target)
    130     import ipdb; ipdb.set_trace()
--> 131     return c.local(cmd)

Remote command works fine with ssh agent running:

ipdb> print(c.run('pwd'))
/root
Command exited with status 0.
=== stdout ===
/root

(no stderr)

c.local("rsync -pthrvz --rsh='ssh -p 22 ' /Users/user/work/project/configs root@1.2.3.4:/tmp") asks for ssh key:

ipdb> c
Enter passphrase for key '/Users/user/.ssh/id_rsa':

Running the same command from the shell works fine:

% rsync  -pthrvz  --rsh='ssh  -p 22 ' /Users/user/work/project/configs root@1.2.3.4:/tmp
sending an incremental file list

sent 237 bytes  received 18 bytes  72.86 bytes/sec
total size is 10.45K  speedup is 40.99

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions