From dfe60526eb7df92abf62957d4d7b3a12a810aed4 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 5 Feb 2014 11:37:02 -0600 Subject: [PATCH] Add copy_file() to scp files between remotes Signed-off-by: Zack Cerza --- teuthology/misc.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/teuthology/misc.py b/teuthology/misc.py index 80af2a4209..c8c9fd0cbe 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -435,6 +435,18 @@ def sudo_write_file(remote, path, data, perms=None): ) +def copy_file(from_remote, from_path, to_remote, to_path=None): + """ + Copies a file from one remote to another. + """ + if to_path is None: + to_path = from_path + from_remote.run(args=[ + 'sudo', 'scp', '-v', from_path, "{host}:{file}".format( + host=to_remote.name, file=to_path) + ]) + + def move_file(remote, from_path, to_path, sudo=False): """ Move a file from one path to another on a remote site -- 2.39.5