Skip to content

Commit

Permalink
T4930: change file writing method
Browse files Browse the repository at this point in the history
  • Loading branch information
sskaje committed Jan 12, 2025
1 parent 26b6908 commit 91e3138
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/conf_mode/interfaces_wireguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ def apply(wireguard):
## DOMAIN RESOLVER
domain_action = 'restart'
if 'peers_need_resolve' in wireguard and len(wireguard['peers_need_resolve']) > 0:
from vyos.utils.file import write_file

text = f'# Automatically generated by interfaces_wireguard.py\nThis file indicates that vyos-domain-resolver service is used by the interfaces_wireguard.\n'
text += "intefaces:\n" + "".join([f" - {peer}\n" for peer in wireguard['peers_need_resolve']])
Path(domain_resolver_usage).write_text(text)
write_file(domain_resolver_usage, text)
else:
Path(domain_resolver_usage).unlink(missing_ok=True)
if not Path('/run').glob('use-vyos-domain-resolver*'):
Expand Down

0 comments on commit 91e3138

Please sign in to comment.