Open paolacernada opened 3 weeks ago
I encountered an issue while using the CapacityApi.find_capacity_for_metro endpoint from the Equinix Python SDK. The error indicated that a NoneType
object was being iterated over, suggesting that the API call might be returning None
or an empty list instead of the expected data. Here is the specific error message:
'NoneType' object is not iterable
Any insights or directions are appreciated.
@paolacernada Quick note on the commits. Use git squash
to squash all the feat
commits into a single commit.
The code is failing with the following error due to a bug in the SDK:
File "/tmp/ansible_equinix.cloud.metal_metro_capacity_info_payload_csk2ijq1/ansible_equinix.cloud.metal_metro_capacity_info_payload.zip/ansible_collections/equinix/cloud/plugins/module_utils/metal/metal_api.py", line 447, in populate_ids_from_hrefs return_dict = response.to_dict()
File "/home/pcernada/.local/lib/python3.10/site-packages/equinix_metal/models/capacity_list.py", line 79, in to_dict _field_dict[_key] = self.capacity[_key].to_dict() AttributeError: 'dict' object has no attribute 'to_dict'
This error occurs because the to_dict
method is being called on a dictionary object, which does not have this method. The capacity
field in the capacity_list
model is expected to contain objects with a to_dict
method, but it currently contains plain dictionaries instead.
Added a new Ansible module named metal_capacity_metro_info to gather capacity information for Equinix Metal metros.