From 19ed9940006439a6a634eef0b591b81b4a5e2964 Mon Sep 17 00:00:00 2001 From: Hugo Herter Date: Wed, 20 Mar 2024 17:00:47 +0100 Subject: [PATCH] Fix: Failing to restart `nddpd` caused the exception to escalate The `ndppd` service is not always required and restarting it can fail. While waiting for a better fix that prevents restarting the service too quickly, this logs an error instead of raising an exception. --- src/aleph/vm/network/ndp_proxy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/aleph/vm/network/ndp_proxy.py b/src/aleph/vm/network/ndp_proxy.py index 0af97b7d4..60e73b287 100644 --- a/src/aleph/vm/network/ndp_proxy.py +++ b/src/aleph/vm/network/ndp_proxy.py @@ -14,6 +14,7 @@ from dataclasses import dataclass from ipaddress import IPv6Network from pathlib import Path +from subprocess import CalledProcessError from aleph.vm.utils import run_in_subprocess @@ -33,7 +34,11 @@ def __init__(self, host_network_interface: str): @staticmethod async def _restart_ndppd(): logger.debug("Restarting ndppd") - await run_in_subprocess(["systemctl", "restart", "ndppd"]) + try: + await run_in_subprocess(["systemctl", "restart", "ndppd"]) + except CalledProcessError as error: + logger.error("Failed to restart ndppd: %s", error) + # We do not raise the error here, since this should not crash the entire system async def _update_ndppd_conf(self): config = f"proxy {self.host_network_interface} {{\n"