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

Pydantic validation error for CloudvisionCustomField when syncing data #609

Open
erjac77 opened this issue Dec 1, 2024 · 1 comment
Open
Labels
integration: cloudvision Issues/PRs for the Arista CloudVision SSoT integration. type: bug Issues/PRs addressing a bug.

Comments

@erjac77
Copy link

erjac77 commented Dec 1, 2024

Environment

  • Python version: 3.11.10
  • Nautobot version: 2.3.12
  • nautobot-ssot version: 3.2.0

Expected Behavior

Sync from CV to Nautobot should finish successfully.

Observed Behavior

When syncing data from CloudVision to Nautobot, we get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 477, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/jobs.py", line 1136, in run_job
    result = job(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/jobs.py", line 149, in __call__
    return self.run(*args, **deserialized_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/integrations/aristacv/jobs.py", line 125, in run
    super().run(dryrun=self.dryrun, memory_profiling=self.memory_profiling, *args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/jobs/base.py", line 355, in run
    self.sync_data(memory_profiling)
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/jobs/base.py", line 158, in sync_data
    self.load_source_adapter()
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/integrations/aristacv/jobs.py", line 104, in load_source_adapter
    self.source_adapter.load()
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/integrations/aristacv/diffsync/adapters/cloudvision.py", line 303, in load
    self.load_devices()
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/integrations/aristacv/diffsync/adapters/cloudvision.py", line 105, in load_devices
    self.load_device_tags(device=new_device)
  File "/usr/local/lib/python3.11/site-packages/nautobot_ssot/integrations/aristacv/diffsync/adapters/cloudvision.py", line 289, in load_device_tags
    new_cf = [self.cf](http://self.cf/)(
             ^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for CloudvisionCustomField
value
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.10/v/string_type

Some CloudvisionCustomField are defined as int or bool, but the DiffSync model expects a str.

{'name': 'arista_vxlanConfigured', 'value': True, 'device_name': 'MYSWITCH'}

"type": CustomFieldTypeChoices.TYPE_BOOLEAN,

Steps to Reproduce

  1. Go to SSoT Dashboard page
  2. Launch a sync job (CloudVision -> Nautobot)
@erjac77 erjac77 changed the title Pydantic validation error for CloudvisionCustomField during a sync Pydantic validation error for CloudvisionCustomField when syncing data Dec 1, 2024
@jdrew82 jdrew82 added type: bug Issues/PRs addressing a bug. integration: cloudvision Issues/PRs for the Arista CloudVision SSoT integration. labels Dec 2, 2024
@ksoufan
Copy link

ksoufan commented Dec 2, 2024

I got similar error for Pydantic, but with different output

File "/opt/nautobot/lib/python3.10/site-packages/pydantic/main.py", line 214, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for CloudvisionCustomField
value
Input should be a valid string [type=string_type, input_value=False, input_type=bool]
For further information visit https://errors.pydantic.dev/2.10/v/string_type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration: cloudvision Issues/PRs for the Arista CloudVision SSoT integration. type: bug Issues/PRs addressing a bug.
Projects
None yet
Development

No branches or pull requests

3 participants