packethost / packet-python

A Python client for the Equinix Metal API
http://metal.equinix.com/
GNU Lesser General Public License v3.0
40 stars 50 forks source link

check is Facility #116

Closed giggsoff closed 3 years ago

giggsoff commented 3 years ago

I try to obtain ips for device without success:

Traceback (most recent call last):
  File "/workspace-private/zintegrationtestutils/packet.py", line 156, in is_public_address_ready
    ip_addresses = self.pkt_instance.ips()
  File "/usr/local/lib/python3.8/site-packages/packet/Device.py", line 106, in ips
    return self.manager.list_device_ips(self.id)
  File "/usr/local/lib/python3.8/site-packages/packet/Manager.py", line 368, in list_device_ips
    ip = IPAddress(jsoned, self)
  File "/usr/local/lib/python3.8/site-packages/packet/IPAddress.py", line 25, in __init__
    self.facility = Facility(data.get("facility"))
  File "/usr/local/lib/python3.8/site-packages/packet/Facility.py", line 7, in __init__
    self.id = data.get("id")
AttributeError: 'NoneType' object has no attribute 'get'

Seems, that facility field is null for my case:

"ip_addresses": [
        {
            "id": "c0b3e747-f85f-4abc-89c0-6683964a1d3c",
...
            "href": "/metal/v1/ips/c0b3e747-f85f-4abc-89c0-6683964a1d3c",
            "facility": null
        }
...
]

Signed-off-by: Petr Fedchenkov giggsoff@gmail.com

displague commented 3 years ago

Thanks for this PR, @giggsoff .

We actually have this change proposed in https://github.com/packethost/packet-python/pull/110/files#diff-3522ca1c96d4e5ee701cee05ad8f930db2db0737f39db8e78a0def08a132e7bcR34

I'm going to close this PR for the more comprehensive set of metro-related changes and I'll ping folks for review.

giggsoff commented 3 years ago

Thank you! Will wait for another PR to merge.

displague commented 3 years ago

fix released in 1.44.0

giggsoff commented 3 years ago

Thanks for mentioning me, the new version works well.