From: Rishabh Dave Date: Tue, 9 Jul 2019 11:42:01 +0000 (+0530) Subject: qa/vstart_runner.py: ignores when source and destination are same X-Git-Tag: v15.1.0~2061^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=07688b96e1698c49af1aa6383cd19fbe4f50f7a8;p=ceph-ci.git qa/vstart_runner.py: ignores when source and destination are same 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 --- diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index dd477a62f4f..42319bfe74c 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -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