juju scp should accept multiple targets and pass extra args to scp

Bug #1283412 reported by Dimiter Naydenov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Low
Dimiter Naydenov

Bug Description

OpenSSH scp command supports multiple source and destination targets, like:

scp user1@host1:/path/file1 user@host2:/path/file2 local-dir/

Juju scp command only parses the first and second argument and interprets them as source/destination. If should miminc scp more closely by accepting multiple remote and/or local paths, so that the above can be called as:

$ juju scp ubuntu/0:/var/log/juju/unit-ubuntu-0.log 0:/var/log/juju/all-machines.log remote-logs/
(assuming we have machine 0 and unit ubuntu/0 deployed on machine 1, and the local remote-logs dir exists)

The expected result is the command to succeed and both logs should appear in remote-logs/, but instead in trunk the result is:

ERROR exit status 1 (Warning: Permanently added 'ec2-54-228-163-187.eu-west-1.compute.amazonaws.com,54.228.163.187' (ECDSA) to the list of known hosts.
Host key verification failed.
lost connection)

Also, even though juju scp's help says it supports passing extra arguments to scp, by giving them after --, like:

juju scp -- -r mongodb/0:/var/log/mongodb/ remote-logs/

In fact the implementation does not parse or forward any extra arguments in a way scp can understand:

$ juju scp -- -r 0:/var/log/juju remote-logs/

The expected result is scp succeeds and recursively copies the /var/log/juju dir to remote-logs/, but instead:

ERROR exit status 1 (usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 ... [[user@]host2:]file2)

Tags: ssh tech-debt

Related branches

Changed in juju-core:
milestone: none → 1.17.4
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.