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:
parent
c3c5f36ffc
commit
f075cc668b
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ def main():
|
||||||
updated_content = replace_peer_section(config_content, new_peer_section)
|
updated_content = replace_peer_section(config_content, new_peer_section)
|
||||||
|
|
||||||
# Step 4: Save the updated configuration file
|
# 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 = pathlib.Path(tempdir) / f"{interface}.conf"
|
||||||
temp_file_path = str(temp_file)
|
temp_file_path = str(temp_file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue