From 8b2d757146c1ad853557afa50b6c59b4c72db9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=3D=3DTIM=2E=C2=A9=2EB=20=20=3D=3D?= Date: Fri, 3 Oct 2025 13:33:29 +0200 Subject: [PATCH] Refine IP allocation error handling --- pyalloc/allocator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyalloc/allocator.py b/pyalloc/allocator.py index bbcfa32..26fbf43 100644 --- a/pyalloc/allocator.py +++ b/pyalloc/allocator.py @@ -36,10 +36,10 @@ def allocate(self) -> str: ip_str = str(ip) if ip_str not in self.allocated: self.allocated.add(ip_str) - logger.info(f"Allocated IP: {ip_str}") + logger.info("Allocated IP %s", ip_str) return ip_str - - raise RuntimeError(f"No free IP addresses in {self.network}") + else: + raise RuntimeError("No free IP addresses") def release(self, ip: str) -> bool: """Release an allocated IP address.