]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/vstart_runner.py: ignores when source and destination are same
authorRishabh Dave <ridave@redhat.com>
Tue, 9 Jul 2019 11:42:01 +0000 (17:12 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 25 Jul 2019 05:21:50 +0000 (10:51 +0530)
put_file() in vstart_runner.py should ignore the error when source and
destination paths supplied are same, since source and destination for
put_file() method in teuthology are on different machines, they
represent different locations.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/vstart_runner.py

index dd477a62f4ff8d0c275a9967710152e0464f8fec..42319bfe74cd0c8a892ae644ed937683b5140f88 100644 (file)
@@ -231,8 +231,22 @@ class LocalRemote(object):
         shutil.copy(path, tmpfile)
         return tmpfile
 
+    # XXX: This method ignores the error raised when src and dst are
+    # holding same path. For teuthology, same path still represents
+    # different locations as they lie on different machines.
     def put_file(self, src, dst, sudo=False):
-        shutil.copy(src, dst)
+        if sys.version_info.major < 3:
+            exception = shutil.Error
+        elif sys.version_info.major >= 3:
+            exception = shutil.SameFileError
+
+        try:
+            shutil.copy(src, dst)
+        except exception as e:
+            if sys.version_info.major < 3 and e.message.find('are the same '
+               'file') != -1:
+                return
+            raise e
 
     def _perform_checks_and_return_list_of_args(self, args, omit_sudo):
         # Since Python's shell simulation can only work when commands are