Skip to content
Snippets Groups Projects

Remove cancelation workflow

Merged Karel van Klink requested to merge feature/reconvene-termination-workflows into develop
14 files
+ 73
156
Compare changes
  • Side-by-side
  • Inline
Files
14
+ 6
9
@@ -19,10 +19,6 @@ class AllocationError(Exception):
@@ -19,10 +19,6 @@ class AllocationError(Exception):
"""Raised when Infoblox failed to allocate a resource."""
"""Raised when Infoblox failed to allocate a resource."""
class DeletionError(Exception):
"""Raised when Infoblox failed to delete a resource."""
def _setup_connection() -> tuple[connector.Connector, IPAMParams]:
def _setup_connection() -> tuple[connector.Connector, IPAMParams]:
"""Set up a new connection with an Infoblox instance.
"""Set up a new connection with an Infoblox instance.
@@ -158,7 +154,7 @@ def delete_network(ip_network: ipaddress.IPv4Network | ipaddress.IPv6Network) ->
@@ -158,7 +154,7 @@ def delete_network(ip_network: ipaddress.IPv4Network | ipaddress.IPv6Network) ->
network.delete()
network.delete()
else:
else:
msg = f"Could not find network {ip_network}, nothing has been deleted."
msg = f"Could not find network {ip_network}, nothing has been deleted."
raise DeletionError(msg)
logger.warning(msg)
def allocate_host(
def allocate_host(
@@ -253,8 +249,9 @@ def create_host_by_ip(
@@ -253,8 +249,9 @@ def create_host_by_ip(
:term:`GSO`.
:term:`GSO`.
"""
"""
if not hostname_available(hostname):
if not hostname_available(hostname):
msg = f"Cannot allocate new host, FQDN {hostname} already taken."
msg = f"FQDN {hostname} already taken, nothing to be done."
raise AllocationError(msg)
logger.warning(msg)
 
return
conn, oss = _setup_connection()
conn, oss = _setup_connection()
ipv6_object = objects.IP.create(ip=str(ipv6_address), mac=NULL_MAC, configure_for_dhcp=False)
ipv6_object = objects.IP.create(ip=str(ipv6_address), mac=NULL_MAC, configure_for_dhcp=False)
@@ -331,7 +328,7 @@ def delete_host_by_ip(ip_addr: ipaddress.IPv4Address | ipaddress.IPv6Address) ->
@@ -331,7 +328,7 @@ def delete_host_by_ip(ip_addr: ipaddress.IPv4Address | ipaddress.IPv6Address) ->
host.delete()
host.delete()
else:
else:
msg = f"Could not find host at {ip_addr}, nothing has been deleted."
msg = f"Could not find host at {ip_addr}, nothing has been deleted."
raise DeletionError(msg)
logger.warning(msg)
def delete_host_by_fqdn(fqdn: str) -> None:
def delete_host_by_fqdn(fqdn: str) -> None:
@@ -348,4 +345,4 @@ def delete_host_by_fqdn(fqdn: str) -> None:
@@ -348,4 +345,4 @@ def delete_host_by_fqdn(fqdn: str) -> None:
host.delete()
host.delete()
else:
else:
msg = f"Could not find host at {fqdn}, nothing has been deleted."
msg = f"Could not find host at {fqdn}, nothing has been deleted."
raise DeletionError(msg)
logger.warning(msg)
Loading