-
Notifications
You must be signed in to change notification settings - Fork 39
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
Allow write-enabled SNMP profiles to be used for reading when no read-only profiles are available #2751
Allow write-enabled SNMP profiles to be used for reading when no read-only profiles are available #2751
Conversation
I have yet to properly verify that this works in real life, so keeping in Draft until then... |
cab6497
to
a8a3e4b
Compare
Tested and found to work, but in order to avoid needing to fix issues in the deprecated Netbox properties, this now depends on #2754 to merged first. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2751 +/- ##
=======================================
Coverage 55.62% 55.62%
=======================================
Files 567 567
Lines 41220 41224 +4
=======================================
+ Hits 22928 22932 +4
Misses 18292 18292 ☔ View full report in Codecov by Sentry. |
This changes the logic behind preferred SNMP profile selection, a need that has become apparent while working with SNMPv3 profiles. A read-write profile should be acceptable for read operations if no read-only profile exists. However, if write access is not required, but a write profile is available in addition to a read profile, the read profile should be preferred. This also updates all callers to the new signature, based on their actual needs.
ManagementProfile.snmp_version now avoids crashing in the case of faulty SNMP profiles. Since it was used to sort multiple profiles in order of SNMP version while fetching preferred profiles, the presence of any faulty profile on a Netbox would make `get_preferred_snmp_profile()` unable to fetch any valid profile without crashing. This was discovered by our test suite.
a8a3e4b
to
3ba3a24
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Fixes #2735
Depends on #2754