equinixmetal-archive/packngo

Type mismatch at networks_ports[...]['data']['bonded'] in JSON API

t0mk opened this issue · 3 comments

t0mk commented

Reported by @travis and @denverwilliams in https://github.com/terraform-providers/terraform-provider-packet/issues/133, it seems that with a m2.large.x86 device with OS ubuntu_18_04 in ewr1, the JSON value in networks_ports[...]['data']['bonded'] is sometimes true (type bool) and sometimes "true" (type string). The golang code blows up on this obviously.

It seems that port['data']['bonded']is properly boolean for port bond0, but it's incorrectly string for bond1. Maybe this occurs only in devices with more than one bond?

  "network_ports": [
   {
    "id": "511c0990-5f18-4047-a39a-4bf7daf7a270",
    "type": "NetworkBondPort",
    "name": "bond0",
    "data": {
     "bonded": true # good
    },
    "network_type": "layer2-bonded",
    "native_virtual_network": null,
    "hardware": {
     "href": "/hardware/678f771c-b7f2-411f-8ae3-d67063682333"
    },
    "virtual_networks": [],
    "connected_port": null,
    "href": "/ports/511c0990-5f18-4047-a39a-4bf7daf7a270"
   },
   {
    "id": "ab7b0a73-d55d-43c5-aad7-b876341f2607",
    "type": "NetworkBondPort",
    "name": "bond1",
    "data": {
     "bonded": "true" # bad
    },
    "network_type": "layer2-bonded",
    "native_virtual_network": null,
    "hardware": {
     "href": "/hardware/678f771c-b7f2-411f-8ae3-d67063682333"
    },
    "virtual_networks": [],
    "connected_port": null,
    "href": "/ports/ab7b0a73-d55d-43c5-aad7-b876341f2607"
   }

This blocks https://github.com/terraform-providers/terraform-provider-packet/issues/133

@t0mk I will be adding this to Jira and run it through our prioritization. Thank you!

Are there any updates on this?

t0mk commented

I just tried and it seems that there is always bool type, not a string. I close this.