Skip to content

Commit 9155ffb

Browse files
Bugfix: Removed logic to manipulate query params for ip_address (#421)
1 parent 74a7e4c commit 9155ffb

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
"interface": set(["name", "device", "virtual_machine"]),
286286
"interface_template": set(["name", "device_type"]),
287287
"inventory_item": set(["name", "device"]),
288-
"ip_address": set(["address", "vrf", "interface"]),
288+
"ip_address": set(["address", "vrf", "device", "interface"]),
289289
"ip_addresses": set(["address", "vrf", "device", "interface"]),
290290
"ipaddresses": set(["address", "vrf", "device", "interface"]),
291291
"lag": set(["name"]),
@@ -701,17 +701,6 @@ def _build_query_params(
701701
elif parent == "prefix" and module_data.get("parent"):
702702
query_dict.update({"prefix": module_data["parent"]})
703703

704-
# This is for netbox_ipam and netbox_ip_address module
705-
elif parent == "ip_address" and module_data.get("assigned_object_type"):
706-
if module_data["assigned_object_type"] == "virtualization.vminterface":
707-
query_dict.update(
708-
{"vminterface_id": module_data.get("assigned_object_id")}
709-
)
710-
elif module_data["assigned_object_type"] == "dcim.interface":
711-
query_dict.update(
712-
{"interface_id": module_data.get("assigned_object_id")}
713-
)
714-
715704
elif parent == "ip_addresses":
716705
if isinstance(module_data["device"], int):
717706
query_dict.update({"device_id": module_data["device"]})

tests/integration/targets/latest/tasks/netbox_ip_address.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@
316316
assigned_object:
317317
name: Eth0
318318
virtual_machine: test101-vm
319-
state: "present"
319+
state: "new"
320320
register: test_fifteen
321321

322322
- name: "15 - ASSERT"

tests/integration/targets/v2.9/tasks/netbox_ip_address.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@
316316
assigned_object:
317317
name: Eth0
318318
virtual_machine: test101-vm
319-
state: "present"
319+
state: "new"
320320
register: test_fifteen
321321

322322
- name: "15 - ASSERT"

0 commit comments

Comments
 (0)