mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-04 12:14:11 +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
@ -618,8 +618,12 @@ 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:
|
try:
|
||||||
os.rename(replaced_path, backup_path)
|
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