mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-01 18:56:41 +00:00
replace_file should not fail if replaced_path does not exist.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
472e267075
commit
bfda47fef4
@ -619,7 +619,11 @@ else:
|
|||||||
if not os.path.exists(replacement_path):
|
if not os.path.exists(replacement_path):
|
||||||
raise ConflictError("Replacement file not found: %r" % (replacement_path,))
|
raise ConflictError("Replacement file not found: %r" % (replacement_path,))
|
||||||
try:
|
try:
|
||||||
os.rename(replaced_path, backup_path)
|
try:
|
||||||
|
os.rename(replaced_path, backup_path)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
rename_no_overwrite(replacement_path, replaced_path)
|
rename_no_overwrite(replacement_path, replaced_path)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
reraise(ConflictError)
|
reraise(ConflictError)
|
||||||
|
Loading…
Reference in New Issue
Block a user