diff --git a/plugins/modules/ipam_address_block.py b/plugins/modules/ipam_address_block.py index 49f9809..17f139f 100644 --- a/plugins/modules/ipam_address_block.py +++ b/plugins/modules/ipam_address_block.py @@ -147,6 +147,14 @@ - "The shared DHCP configuration that controls how leases are issued for the address block." type: dict suboptions: + abandoned_reclaim_time: + description: + - "The abandoned reclaim time in seconds for IPV4 clients." + type: int + abandoned_reclaim_time_v6: + description: + - "The abandoned reclaim time in seconds for IPV6 clients." + type: int allow_unknown: description: - "Disable to allow leases only for known IPv4 clients, those for which a fixed address is configured." @@ -466,6 +474,32 @@ - "The inheritance configuration for I(dhcp_config) field." type: dict suboptions: + abandoned_reclaim_time: + description: + - "The inheritance configuration for I(abandoned_reclaim_time) field from I(DHCPConfig) object." + type: dict + suboptions: + action: + description: + - "The inheritance setting for a field." + - "Valid values are:" + - "* I(inherit): Use the inherited value." + - "* I(override): Use the value set in the object." + - "Defaults to I(inherit)." + type: str + abandoned_reclaim_time_v6: + description: + - "The inheritance configuration for I(abandoned_reclaim_time_v6) field from I(DHCPConfig) object." + type: dict + suboptions: + action: + description: + - "The inheritance setting for a field." + - "Valid values are:" + - "* I(inherit): Use the inherited value." + - "* I(override): Use the value set in the object." + - "Defaults to I(inherit)." + type: str allow_unknown: description: - "The inheritance configuration for I(allow_unknown) field from I(DHCPConfig) object." @@ -747,6 +781,10 @@ dhcp_config: lease_time: action: override + abandoned_reclaim_time: + action: inherit + abandoned_reclaim_time_v6: + action: inherit allow_unknown: action: inherit allow_unknown_v6: @@ -936,6 +974,16 @@ type: dict returned: Always contains: + abandoned_reclaim_time: + description: + - "The abandoned reclaim time in seconds for IPV4 clients." + type: int + returned: Always + abandoned_reclaim_time_v6: + description: + - "The abandoned reclaim time in seconds for IPV6 clients." + type: int + returned: Always allow_unknown: description: - "Disable to allow leases only for known IPv4 clients, those for which a fixed address is configured." @@ -1624,6 +1672,66 @@ type: dict returned: Always contains: + abandoned_reclaim_time: + description: + - "The inheritance configuration for I(abandoned_reclaim_time) field from I(DHCPConfig) object." + type: dict + returned: Always + contains: + action: + description: + - "The inheritance setting for a field." + - "Valid values are:" + - "* I(inherit): Use the inherited value." + - "* I(override): Use the value set in the object." + - "Defaults to I(inherit)." + type: str + returned: Always + display_name: + description: + - "The human-readable display name for the object referred to by I(source)." + type: str + returned: Always + source: + description: + - "The resource identifier." + type: str + returned: Always + value: + description: + - "The inherited value." + type: int + returned: Always + abandoned_reclaim_time_v6: + description: + - "The inheritance configuration for I(abandoned_reclaim_time_v6) field from I(DHCPConfig) object." + type: dict + returned: Always + contains: + action: + description: + - "The inheritance setting for a field." + - "Valid values are:" + - "* I(inherit): Use the inherited value." + - "* I(override): Use the value set in the object." + - "Defaults to I(inherit)." + type: str + returned: Always + display_name: + description: + - "The human-readable display name for the object referred to by I(source)." + type: str + returned: Always + source: + description: + - "The resource identifier." + type: str + returned: Always + value: + description: + - "The inherited value." + type: int + returned: Always allow_unknown: description: - "The inheritance configuration for I(allow_unknown) field from I(DHCPConfig) object." @@ -2273,16 +2381,8 @@ def __init__(self, *args, **kwargs): self.params["address"], netmask = self.params["address"].split("/") self.params["cidr"] = int(netmask) - exclude = [ - "state", - "csp_url", - "api_key", - "id", - "abandoned_reclaim_time", - "abandoned_reclaim_time_v6", - "echo_client_id", - ] - + exclude = ["state", "csp_url", "api_key", "id","abandoned_reclaim_time","abandoned_reclaim_time_v6", + "echo_client_id"] self._payload_params = {k: v for k, v in self.params.items() if v is not None and k not in exclude} self._payload = AddressBlock.from_dict(self._payload_params) @@ -2291,14 +2391,6 @@ def __init__(self, *args, **kwargs): self._payload.dhcp_config.abandoned_reclaim_time = None self._payload.dhcp_config.abandoned_reclaim_time_v6 = None self._payload.dhcp_config.echo_client_id = None - - # Handle inheritance sources safely - if self._payload.inheritance_sources and self._payload.inheritance_sources.dhcp_config: - inherited_dhcp_config = self._payload.inheritance_sources.dhcp_config - setattr(inherited_dhcp_config, "abandoned_reclaim_time", None) - setattr(inherited_dhcp_config, "abandoned_reclaim_time_v6", None) - setattr(inherited_dhcp_config, "echo_client_id", None) - self._existing = None @property @@ -2440,6 +2532,8 @@ def main(): dhcp_config=dict( type="dict", options=dict( + abandoned_reclaim_time=dict(type="int"), + abandoned_reclaim_time_v6=dict(type="int"), allow_unknown=dict(type="bool"), allow_unknown_v6=dict(type="bool"), echo_client_id=dict(type="bool"), @@ -2576,6 +2670,18 @@ def main(): dhcp_config=dict( type="dict", options=dict( + abandoned_reclaim_time=dict( + type="dict", + options=dict( + action=dict(type="str"), + ), + ), + abandoned_reclaim_time_v6=dict( + type="dict", + options=dict( + action=dict(type="str"), + ), + ), allow_unknown=dict( type="dict", options=dict( diff --git a/tests/integration/targets/ipam_address_block/tasks/main.yml b/tests/integration/targets/ipam_address_block/tasks/main.yml index 1bf4228..d4ad00c 100644 --- a/tests/integration/targets/ipam_address_block/tasks/main.yml +++ b/tests/integration/targets/ipam_address_block/tasks/main.yml @@ -255,6 +255,10 @@ dhcp_config: lease_time: action: override + abandoned_reclaim_time: + action: inherit + abandoned_reclaim_time_v6: + action: inherit allow_unknown: action: inherit allow_unknown_v6: