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

Use correct value for error handling #116

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

stveit
Copy link
Contributor

@stveit stveit commented Oct 20, 2023

Fixes #81

Uses the var_binds return value from SNMP operations instead of the query input. See #81 for the reason why.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

Merging #116 (3760a02) into master (14da2c9) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #116   +/-   ##
=======================================
  Coverage   96.08%   96.08%           
=======================================
  Files          30       30           
  Lines        1809     1809           
=======================================
  Hits         1738     1738           
  Misses         71       71           
Files Coverage Δ
src/zino/snmp.py 96.63% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

Test results

    3 files      3 suites   56s ⏱️
163 tests 163 ✔️ 0 💤 0
489 runs  487 ✔️ 2 💤 0

Results for commit 3760a02.

@stveit stveit self-assigned this Oct 20, 2023
@hmpf hmpf self-requested a review October 24, 2023 11:54
return self._object_type_to_mib_object(var_binds[0])

def _raise_errors(
self,
error_indication: Union[str, errind.ErrorIndication],
error_status: str,
error_index: int,
*query: ObjectType,
var_binds: Sequence[ObjectType],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better name, but I hope the change isn't due to shutting up mypy... Would

*var_binds: Optional[Sequence[ObjectType]],

work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would work, but the getCmd commands and such always returns a list, and this function is meant to process that.
error_index points to something in var_binds, so taking a Sequence directly instead of *args felt more appropriate to me.

Optional is a good point, that might be applicable for all the arguments

@stveit stveit merged commit b77fac9 into master Nov 28, 2023
@lunkwill42 lunkwill42 deleted the snmp/use-correct-value-for-error-handling branch January 12, 2024 12:03
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.

Wrong value used for error handling in snmp module
2 participants