Skip to content

Commit 7593e6f

Browse files
BugFix: remove-static-lag definition and dynamically fetch (#109)
1 parent eb30321 commit 7593e6f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,10 @@ def _build_query_params(self, parent, module_data, child=None):
462462
if parent == "lag":
463463
if not child:
464464
query_dict["name"] = module_data["lag"]
465-
query_dict.update({"form_factor": 200})
465+
intf_type = self._fetch_choice_value(
466+
"Link Aggregation Group (LAG)", "interfaces"
467+
)
468+
query_dict.update({"form_factor": intf_type})
466469
if isinstance(module_data["device"], int):
467470
query_dict.update({"device_id": module_data["device"]})
468471
else:

tests/unit/module_utils/test_netbox_base_class.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ def test_build_query_params_child(
222222
"%s%s" % (MOCKER_PATCH_PATH, "._get_query_param_id")
223223
)
224224
get_query_param_id.return_value = 1
225+
# This will need to be updated, but attempting to fix issue quickly
226+
fetch_choice_value = mocker.patch(
227+
"%s%s" % (MOCKER_PATCH_PATH, "._fetch_choice_value")
228+
)
229+
fetch_choice_value.return_value = 200
230+
225231
query_params = mock_netbox_module._build_query_params(parent, module_data, child)
226232
assert query_params == expected
227233

0 commit comments

Comments
 (0)