]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add copy_file() to scp files between remotes
authorZack Cerza <zack@cerza.org>
Wed, 5 Feb 2014 17:37:02 +0000 (11:37 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 20 Feb 2014 23:46:05 +0000 (17:46 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/misc.py

index 80af2a42099935654ff8135b7999c74a42828a22..c8c9fd0cbefa4f84fceb703024bab6ec28009153 100644 (file)
@@ -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