Ignore rm errors

This commit is contained in:
LilyRose2798 2024-04-17 01:49:46 +10:00
parent 32272650da
commit bd76f6f6fa
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from fabric import Connection from fabric import Connection
from invoke.exceptions import UnexpectedExit
from pathlib import Path from pathlib import Path
from sys import stderr from sys import stderr
from io import StringIO from io import StringIO
@ -51,7 +52,10 @@ def generate_wg_configs(config: WovenConfig):
cs = { id: Connection(node.listen_address, user = "root") for id, node in config.nodes.items() } cs = { id: Connection(node.listen_address, user = "root") for id, node in config.nodes.items() }
for c in cs.values(): for c in cs.values():
c.run("for f in /etc/wireguard/*-loop.conf; do systemctl stop wg-quick@$(basename $f .conf).service; done") c.run("for f in /etc/wireguard/*-loop.conf; do systemctl stop wg-quick@$(basename $f .conf).service; done")
try:
c.run("rm /etc/wireguard/*-loop.conf") c.run("rm /etc/wireguard/*-loop.conf")
except UnexpectedExit:
pass
ptp_ipv4_network_iter = ptp_ipv4_network.subnets(new_prefix = config.ptp_ipv4_subnet) ptp_ipv4_network_iter = ptp_ipv4_network.subnets(new_prefix = config.ptp_ipv4_subnet)
ptp_ipv6_network_iter = ptp_ipv6_network.subnets(new_prefix = config.ptp_ipv6_subnet) ptp_ipv6_network_iter = ptp_ipv6_network.subnets(new_prefix = config.ptp_ipv6_subnet)