[Windows] Security model for files permissions - STEP 3b (#6965)

* Modifications for misc

* Add some types

* Use os_rename

* Move rename into filesystem

* Use our os package

* Rename filesystem.rename to filesystem.replace

* Disable globally function redefined lint in os module
This commit is contained in:
Adrien Ferrand
2019-06-11 17:08:48 -07:00
committed by Brad Warren
parent 72e5d89e95
commit d75908c645
9 changed files with 82 additions and 77 deletions
+3 -3
View File
@@ -18,8 +18,8 @@ from certbot import crypto_util
from certbot import error_handler
from certbot import errors
from certbot import util
from certbot.compat import misc
from certbot.compat import os
from certbot.compat import filesystem
from certbot.plugins import common as plugins_common
from certbot.plugins import disco as plugins_disco
@@ -162,7 +162,7 @@ def rename_renewal_config(prev_name, new_name, cli_config):
raise errors.ConfigurationError("The new certificate name "
"is already in use.")
try:
os.rename(prev_filename, new_filename)
filesystem.replace(prev_filename, new_filename)
except OSError:
raise errors.ConfigurationError("Please specify a valid filename "
"for the new certificate name.")
@@ -191,7 +191,7 @@ def update_configuration(lineagename, archive_dir, target, cli_config):
# Save only the config items that are relevant to renewal
values = relevant_values(vars(cli_config.namespace))
write_renewal_config(config_filename, temp_filename, archive_dir, target, values)
misc.os_rename(temp_filename, config_filename)
filesystem.replace(temp_filename, config_filename)
return configobj.ConfigObj(config_filename)