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

Fix Can't convert with callable None - for junos routers #1931

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

teresalves
Copy link

@teresalves teresalves commented May 23, 2023

The code keeps breaking on this line: https://github.com/napalm-automation/napalm/blob/develop/napalm/junos/junos.py#L1339
when there is a key that is not included in the GROUP_FIELDS_DATATYPE_MAP
In particular, for the group names "multihop" and "cluster" this is a problem because it will inevitably show up in the router configs, but the datatype will always be None, which will provoke this error:
ValueError: Can't convert with callable None - no default is defined for this type.
originating from here

In previous versions, this convert function was not doing the type checks, so if it was just returning None. The value for this case is irrelevant because both are deleted from the config further (here and here), respectively. Their existence in the config is temporary and not necessary - it is only used to produce/update other values (here and here)

Therefore, I added here a conditional clause that never adds them to the final bgp config, so there is no need to delete it further ahead. Instead, a separate object is created for validation.

Issue: #1932

@mirceaulinic
Copy link
Member

@teresalves sorry for late review, would you mind updating your branch? Thanks.

@mirceaulinic mirceaulinic added this to the 5.0.0 milestone Mar 21, 2024
@teresalves
Copy link
Author

Hey @mirceaulinic ! Thanks for taking a look
Updated now, could you recheck please?

@mirceaulinic mirceaulinic merged commit 3d1a1e1 into napalm-automation:develop Mar 25, 2024
6 checks passed
@mirceaulinic
Copy link
Member

Thanks @teresalves!

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

Successfully merging this pull request may close these issues.

2 participants