mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 23:32:06 -04:00
Temporary fix, REVERT
This commit is contained in:
parent
ae76f2d3b5
commit
0976176a56
1 changed files with 13 additions and 0 deletions
|
|
@ -19,6 +19,9 @@ from certbot import util
|
|||
|
||||
from certbot.compat import os
|
||||
|
||||
# TEMPORARY WORKAROUND
|
||||
import os as stdlib_os
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -76,9 +79,19 @@ def safe_copy(source, target):
|
|||
copied or the target file hash does not match
|
||||
with the source file.
|
||||
"""
|
||||
orig_perms = None
|
||||
try:
|
||||
orig_perms = stdlib_os.stat(target)
|
||||
except OSError:
|
||||
# target file was not found
|
||||
pass
|
||||
|
||||
for _ in range(3):
|
||||
try:
|
||||
shutil.copy2(source, target)
|
||||
if orig_perms:
|
||||
stdlib_os.chown(target, orig_perms.st_uid)
|
||||
stdlib_os.chmod(target, oct(orig_perms.st_mode & 0o777))
|
||||
except IOError as e:
|
||||
emsg = "Could not copy {} to {}: {}".format(
|
||||
source, target, e
|
||||
|
|
|
|||
Loading…
Reference in a new issue