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

Potential KeyError in SSOT Integration with ACI (nautobot_ssot/integrations/aci/diffsync/models/nautobot.py) #558

Closed
TheHack42 opened this issue Oct 2, 2024 · 1 comment · Fixed by #559
Assignees
Labels
integration: ciscoaci Issues/PRs for Cisco ACI integration. type: bug Issues/PRs addressing a bug.

Comments

@TheHack42
Copy link

Hello,

I'm encountering a potential issue in the SSOT integration with ACI, specifically in the following code:

adapter.job.logger.warning(f"Tenant {attrs['vrf_tenant']} not found for VRF {attrs['vrf']}")

Problem:
The code is trying to access "vrf" as an attribute from the attrs dictionary.
However, "vrf" is not an attribute in attrs; it is actually an identifier of the DiffSyncModel. Therefore, "vrf" should be accessed from the ids dictionary instead, like so: ids["vrf"]

If we continue accessing "vrf" via attrs["vrf"], a KeyError will be raised when this code attempts to log the warning.

Suggested Fix:
We should update the logger line to properly access "vrf" from ids:
adapter.job.logger.warning(f"Tenant {attrs['vrf_tenant']} not found for VRF {ids['vrf']}").

Please apply the necessary fix.

Thanks

@jdrew82 jdrew82 added type: bug Issues/PRs addressing a bug. integration: ciscoaci Issues/PRs for Cisco ACI integration. labels Oct 2, 2024
@jdrew82 jdrew82 self-assigned this Oct 2, 2024
@jdrew82
Copy link
Contributor

jdrew82 commented Oct 2, 2024

Good catch! I'll get a PR in to fix this. BTW, in the future we do accept PRs from the community.

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

Successfully merging a pull request may close this issue.

2 participants