-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fixes: #409 #410
Fixes: #409 #410
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for notifying us of this problem and for taking the additional initiative to provide a fix for the problem.
Although this situation should never occur with a hardware switch (or any switch), regardless of the initial state, we have seen a similar problem occur in the past with GNS3 'interfaces' configuration due to invalid GNS3 output for some of the interfaces in a bulk REST 'GET' of 'interfaces' configuration. (There is a bug in the GNS3 drivers related to this, because any interface that exists, should at least have configuration containing the 'name' of the interface, but this is sometimes absent for GNS3 switches.)
This looks like a related cause.
Because there is another direct access to a dict member that could, theoretically, not exist in the first instruction of the 'for intf in interfaces:' loop, we should add protection there along with the protection that you have proposed in this PR.
Please add this as well by also changing the following instructions from:
for intf in interfaces:
name = intf['name']
to:
for intf in interfaces:
name = intf.get('name')
if not name:
continue
I have one additional request to make the content of this PR conformant to the criteria enforced by our 'sanity' checks that must pass before merging for each PR:
Please add a 'changelog' fragment for this fix. This is a file containing two lines describing the fix category and what the fix does. It is needed in the 'changelogs/fragments' directory of the repo. It generates a corresponding entry in our release notes when we include the fix in our next release. You can see other examples that have already been placed in that directory for reference on the format of the changelog file.
For this fix, it would be fine to put the following content in the "410-sonic_l2_interfaces-fix-facts-exception.yaml" file:
---
bugfixes:
- sonic_l2_interfaces - Fix exception when gathering facts (https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/410).
Added the changes. Thank you for the quick response! I was thinking this was a GNS3 or the Virtual Switch related, because it seemed to be such a weird bug. EDIT: Also ran my playbook with the last changes as well to verify it was still OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making these incremental changes.
The current proposed code changes and corresponding sanity test results look good.
Thank you very much for your help in identifying this problem and providing the fix for it.
Approved.
SUMMARY
GitHub Issues
List the GitHub issues impacted by this PR. If no Github issues are affected, please indicate this with "N/A".
ISSUE TYPE
COMPONENT NAME
sonic_l2_interfaces
OUTPUT
ADDITIONAL INFORMATION
Checklist:
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also list any relevant details for your test configuration