Skip to content
Snippets Groups Projects
Commit e60abb23 authored by JORGE SASIAIN's avatar JORGE SASIAIN
Browse files

NAT-212/213: try to fix lint-documentation

parent cfe528c9
Branches
Tags
1 merge request!52Feature/nat 212 213
Pipeline #83773 passed
...@@ -46,8 +46,8 @@ REQUESTS_TIMEOUT = 20 ...@@ -46,8 +46,8 @@ REQUESTS_TIMEOUT = 20
# TODO: remove this! # TODO: remove this!
# lab infoblox cert is not valid for the ipv4 address # lab infoblox cert isn't valid for the ipv4 address
# ... disable warnings for now # disable warnings for now
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
...@@ -299,11 +299,11 @@ def find_next_available_ip(infoblox_params, network_ref: str = ""): ...@@ -299,11 +299,11 @@ def find_next_available_ip(infoblox_params, network_ref: str = ""):
Args: Args:
---- ----
infoblox_params (settings.InfoBloxParams): infoblox params infoblox_params (settings.InfoBloxParams): infoblox params
network_ref (str): the network to find the next available ip, in InfoBlox reference format network_ref (str): the network to find the next available IP, in InfoBlox reference format
Returns: Returns:
------- -------
(str): next available ip in the network, or "NETWORK_FULL" if there's no space in the network (str): next available IP in the network, or "NETWORK_FULL" if there's no space in the network
""" """
r = requests.post( r = requests.post(
...@@ -332,7 +332,7 @@ def allocate_host_inner( # noqa: C901 ...@@ -332,7 +332,7 @@ def allocate_host_inner( # noqa: C901
extattrs: Optional[dict] = None, extattrs: Optional[dict] = None,
) -> Union[HostAddresses, str]: ) -> Union[HostAddresses, str]:
# TODO: should hostnames be unique # TODO: should hostnames be unique
# (i.e. fail if hostname already exists in this domain/service)? # (fail if hostname already exists in this domain/service)?
if cname_aliases is None: if cname_aliases is None:
cname_aliases = [] cname_aliases = []
if extattrs is None: if extattrs is None:
...@@ -342,7 +342,7 @@ def allocate_host_inner( # noqa: C901 ...@@ -342,7 +342,7 @@ def allocate_host_inner( # noqa: C901
assert oss.IPAM.INFOBLOX assert oss.IPAM.INFOBLOX
infoblox_params = oss.IPAM.INFOBLOX infoblox_params = oss.IPAM.INFOBLOX
# If networks is not None, allocate host in those networks. # If networks isn't None, allocate host in those networks.
if networks: if networks:
ipv4_network = networks[0] ipv4_network = networks[0]
ipv6_network = networks[1] ipv6_network = networks[1]
...@@ -370,7 +370,7 @@ def allocate_host_inner( # noqa: C901 ...@@ -370,7 +370,7 @@ def allocate_host_inner( # noqa: C901
if ipv6_addr == "NETWORK_FULL": if ipv6_addr == "NETWORK_FULL":
return "IPV6_NETWORK_FULL" return "IPV6_NETWORK_FULL"
# Otherwise if addrs is not None, allocate host with those addresses. # Otherwise if addrs isn't None, allocate host with those addresses.
else: else:
ipv4_addr = addrs[0] ipv4_addr = addrs[0]
ipv6_addr = addrs[1] ipv6_addr = addrs[1]
...@@ -432,7 +432,7 @@ def allocate_host( # noqa: C901 ...@@ -432,7 +432,7 @@ def allocate_host( # noqa: C901
service_type (str): the name of the service type (e.g. "TRUNK") service_type (str): the name of the service type (e.g. "TRUNK")
service_networks (ServiceNetworks, optional): ipv4 and ipv6 network to allocate host service_networks (ServiceNetworks, optional): ipv4 and ipv6 network to allocate host
host_addresses (HostAddresses, optional): ipv4 and ipv6 addresses to allocate host (service_networks has precedence) host_addresses (HostAddresses, optional): ipv4 and ipv6 addresses to allocate host (service_networks has precedence)
cname_aliases (list, optional): to create cname records in addition to the host record cname_aliases (list, optional): to create CNAME records in addition to the host record
extattrs (dict, optional): any extensible attributes to add in IPAM (e.g. "Site": {"value": "dummy"}) extattrs (dict, optional): any extensible attributes to add in IPAM (e.g. "Site": {"value": "dummy"})
Returns: Returns:
...@@ -570,7 +570,7 @@ def delete_network( ...@@ -570,7 +570,7 @@ def delete_network(
ip_version = ip_network_version(str(network)) ip_version = ip_network_version(str(network))
# Ensure that the network to be deleted is under the service type. # Ensure that the network to be deleted is under the service type.
# Otherwise user is not allowed to delete it # Otherwise user isn't allowed to delete it
oss_ipv4_containers = getattr(ipam_params, service_type).V4.containers oss_ipv4_containers = getattr(ipam_params, service_type).V4.containers
oss_ipv6_containers = getattr(ipam_params, service_type).V6.containers oss_ipv6_containers = getattr(ipam_params, service_type).V6.containers
oss_ipv4_networks = getattr(ipam_params, service_type).V4.networks oss_ipv4_networks = getattr(ipam_params, service_type).V4.networks
...@@ -663,7 +663,7 @@ def delete_host( ...@@ -663,7 +663,7 @@ def delete_host(
assert "_ref" in host_data[0], "Host to delete does not exist in IPAM." assert "_ref" in host_data[0], "Host to delete does not exist in IPAM."
host_ref = host_data[0]["_ref"] host_ref = host_data[0]["_ref"]
# Find cname records reference # Find CNAME records reference
r = requests.get( r = requests.get(
f"{wapi(infoblox_params)}/record:cname", f"{wapi(infoblox_params)}/record:cname",
params={ params={
...@@ -768,7 +768,7 @@ def validate_host( ...@@ -768,7 +768,7 @@ def validate_host(
assert len(host_data) == 1, "Host to validate does not exist in IPAM." assert len(host_data) == 1, "Host to validate does not exist in IPAM."
assert "_ref" in host_data[0], "Host to validate does not exist in IPAM." assert "_ref" in host_data[0], "Host to validate does not exist in IPAM."
# Find cname records reference # Find CNAME records reference
r = requests.get( r = requests.get(
f"{wapi(infoblox_params)}/record:cname", f"{wapi(infoblox_params)}/record:cname",
params={ params={
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment