From d94ff3df929317271acd47203a8ea4d435508487 Mon Sep 17 00:00:00 2001
From: Mohammad Torkashvand <mohammad.torkashvand@geant.org>
Date: Tue, 18 Jun 2024 13:42:36 +0200
Subject: [PATCH] raise exception in case there is already taken host in
 infoblox

---
 gso/services/infoblox.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gso/services/infoblox.py b/gso/services/infoblox.py
index c414aae5..d340ce97 100644
--- a/gso/services/infoblox.py
+++ b/gso/services/infoblox.py
@@ -250,9 +250,8 @@ def create_host_by_ip(
                         :term:`GSO`.
     """
     if not hostname_available(hostname):
-        msg = f"FQDN {hostname} already taken, nothing to be done."
-        logger.warning(msg)
-        return
+        msg = f"FQDN '{hostname}' is already in use, allocation aborted."
+        raise AllocationError(msg)
 
     conn, oss = _setup_connection()
     ipv6_object = objects.IP.create(ip=str(ipv6_address), mac=NULL_MAC, configure_for_dhcp=False)
-- 
GitLab