-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
networktocode.nautobot.cable tries to use device_id
in query to find a device, results in failure.
#320
Comments
At a first glance I'm going to guess that we need to add nautobot-ansible/plugins/module_utils/utils.py Lines 357 to 373 in e10829a
|
Thanks for pointing that out. Although adding for match in matches:
if match in QUERY_PARAMS_IDS and parent not in IGNORE_ADDING_IDS:
raise Exception(f'{parent = }')
if child:
query_id = self._get_query_param_id(match, child)
else:
query_id = self._get_query_param_id(match, module_data)
query_dict.update({match + "_id": query_id})
else:
if child:
value = child.get(match)
else:
value = module_data.get(match)
query_dict.update({match: value}) This starts on line 664 in the same utils.py file. Note I added the Looking back in here: # Some API endpoints dropped '_id' in filter fields in 2.0, ignore them here.
IGNORE_ADDING_IDS = {
"ip_address_to_interface",
"device_bay",
"inventory_item",
"circuit_termination",
"rear_port",
"front_port",
"console_port",
"console_server_port",
"dcim.powerport", #<<<<<
"dcim.poweroutlet", #<<<<<
"power_port",
"power_outlet",
"dcim.consoleport",
"dcim.consoleserverport",
"circuits.circuittermination",
"services",
} I see that |
Thanks!
That's what we have tests for 😄. |
ISSUE TYPE
SOFTWARE VERSIONS
pynautobot
2.1.0
Ansible:
core 2.14.0
Nautobot:
v2.0.5
Collection:
5.1.1
SUMMARY
Using
networktocode.nautobot.cable
results in errormsg: '{"device_id":["Unknown filter field"]}'
STEPS TO REPRODUCE
Assuming the above versions, create a device with a power outlet (riley-server-1 in my examples) and another device with a power port (riley-outlet-1 in my examples)
Run the example
test_cable.yml
playbook:ansible-playbook -i inventory/inventory.yaml test_cable.yml -vvvvvvvvvvvvvv
EXPECTED RESULTS
I expected a simple change that resulted in a cable connection like this:
ACTUAL RESULTS
Operation failed, returned message
msg: '{"device_id":["Unknown filter field"]}'
The text was updated successfully, but these errors were encountered: