Skip to content
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

Errors parsing devices with partition data #93

Open
displague opened this issue Apr 4, 2024 · 0 comments
Open

Errors parsing devices with partition data #93

displague opened this issue Apr 4, 2024 · 0 comments

Comments

@displague
Copy link
Member

via @dlotterman:

I have a loop that paginates / goes through https://github.com/equinix-labs/metal-python/blob/main/equinix_metal/docs/DevicesApi.md#find_organization_devices
The pagination loop works, say 5-10 devices at a time, with sleeps in between. Somewhere around 20 pages in, I'll get a bomb out:

[C 240404 16:47:45 metal_ra:63] ValidationError was raised: 1 validation error for Partition                                size                                                                                                                      Input should be a valid string [type=string_type, input_value=0, input_type=int]                                          For further information visit https://errors.pydantic.dev/2.6/v/string_type                                     ValidationError^[[5~ValidationError^[[5~[C 240404 16:47:55 metal_ra:63] ValidationError was raised: 1 validation error for Partition                                                                                                                size
      Input should be a valid string [type=string_type, input_value=0, input_type=int]
        For further information visit https://errors.pydantic.dev/2.6/v/string_typ

It looks like the partition code from models is erroring:
https://github.com/search?q=repo%3Aequinix-labs%2Fmetal-python+Partition&type=code

   "devices": [Device.from_dict(_item) for _item in obj["devices"]] if obj.get("devices") is not None else None,
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/equinix_metal/models/device.py", line 253, in from_dict
    "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/equinix_metal/models/storage.py", line 111, in from_dict
    "disks": [Disk.from_dict(_item) for _item in obj["disks"]] if obj.get("disks") is not None else None,
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/equinix_metal/models/storage.py", line 111, in <listcomp>
    "disks": [Disk.from_dict(_item) for _item in obj["disks"]] if obj.get("disks") is not None else None,
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/equinix_metal/models/disk.py", line 97, in from_dict
    "partitions": [Partition.from_dict(_item) for _item in obj["partitions"]] if obj.get("partitions") is not None else None,
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/equinix_metal/models/disk.py", line 97, in <listcomp>
    "partitions": [Partition.from_dict(_item) for _item in obj["partitions"]] if obj.get("partitions") is not None else None,
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/equinix_metal/models/partition.py", line 86, in from_dict
    _obj = cls.model_validate({
  File "~/code/github/metal_ra/.venv/lib/python3.10/site-packages/pydantic/main.py", line 509, in model_validate
    return cls.__pydantic_validator__.validate_python(
pydantic_core._pydantic_core.ValidationError: 1 validation error for Partition
size

Is it possible that a device in inventory can't be parsed if it contains CPR (partition) data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant