fix(config): resolve tempfile mode error in config update

Removed `delete=False, mode='w'` from `TemporaryDirectory` to fix incorrect usage that caused potential errors. Ensures temporary directory is properly cleaned up and simplifies the tempfile creation process. This update improves file handling and stability.
This commit is contained in:
Kumi 2024-07-18 18:50:58 +02:00
parent c3c5f36ffc
commit f075cc668b
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -62,7 +62,7 @@ def main():
updated_content = replace_peer_section(config_content, new_peer_section)
# Step 4: Save the updated configuration file
with tempfile.TemporaryDirectory(delete=False, mode='w') as tempdir:
with tempfile.TemporaryDirectory() as tempdir:
temp_file = pathlib.Path(tempdir) / f"{interface}.conf"
temp_file_path = str(temp_file)