1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00
Files
certbot/certbot
Adrien Ferrand 4edfb3ef65 [Windows] Handle file renaming when the destination path already exists (#6415)
On Linux, you can invoke os.rename(src, dst) even if dst already exists. In this case, destination file will be atomically replaced by the source file.

On Windows, this will lead to an OSError because changes are not atomic. This cause certbot renew to fail in particular, because the old certificate configuration needs to be replace by the new when a certificate is effectively renewed.

One could use the cross-platform function os.replace, but it is available only on Python >= 3.3.

This PR add a function in compat to handle correctly this case on Windows, and delegating everything else to os.rename.

* Cross platform compatible os.rename (we can use os.replace if its python 3)

* Use os.replace instead of custom non-atomic code.

* Avoid errors for lint and mypy. Add a test.
2018-11-06 15:35:09 -08:00
..
2018-11-05 14:07:09 -08:00
2018-09-05 15:42:01 -07:00
2016-04-13 16:03:59 -07:00
2018-05-23 20:40:34 -07:00
2018-10-19 14:53:15 -07:00
2016-04-13 16:13:50 -07:00
2018-10-19 14:53:15 -07:00