Uninett / zino

Zino 2.0 - Network state monitor for research networks
Apache License 2.0
3 stars 5 forks source link

Output more user-friendly error reports for `polldevs.py` parsing errors #248

Closed lunkwill42 closed 3 months ago

lunkwill42 commented 3 months ago

Closes #247

Examples of output:

ERROR - zino.scheduler (MainThread) - polldevs.cf:4: 'foobar' is not a valid configuration line
ERROR - zino.scheduler (MainThread) - polldevs.cf:11: Validation error in device block 'N/A': Field required ('name')
ERROR - zino.scheduler (MainThread) - polldevs.cf:11: Validation error in device block 'example-gw': Input is not a valid IPv4 address ('address')

Still missing added test coverage.

github-actions[bot] commented 3 months ago

πŸ¦™ MegaLinter status: βœ… SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
βœ… PYTHON black 72 0 1.2s
βœ… PYTHON isort 72 0 0.28s
βœ… PYTHON ruff 72 0 0.02s

See detailed report in MegaLinter reports

_MegaLinter is graciously provided by OX Security_

github-actions[bot] commented 3 months ago

Test results

  3 files    3 suites   51s :stopwatch: 330 tests 330 :white_check_mark: 0 :zzz: 0 :x: 990 runsβ€Šβ€ƒ988 :white_check_mark: 2 :zzz: 0 :x:

Results for commit df53122d.

:recycle: This comment has been updated with latest results.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.95%. Comparing base (8db7776) to head (df53122).

Files Patch % Lines
src/zino/config/polldevs.py 97.30% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #248 +/- ## ========================================== - Coverage 98.96% 98.95% -0.01% ========================================== Files 49 49 Lines 6565 6593 +28 ========================================== + Hits 6497 6524 +27 - Misses 68 69 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

lunkwill42 commented 3 months ago

What do you think, @runborg ?

runborg commented 3 months ago

The examples in first post are great! informative messages :)

hmpf commented 3 months ago

πŸ¦™ MegaLinter status: βœ… SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time βœ… PYTHON black 3 0 0.53s βœ… PYTHON isort 3 0 0.23s βœ… PYTHON ruff 3 0 0.01s

ruff can do the job of both black and isort. ruff is even incompatible with black in a few cases.

johannaengland commented 3 months ago

ruff can do the job of both black and isort. ruff is even incompatible with black in a few cases.

But this has nothing to do with this PR, you can open an issue/a discussion about which linters to use

runborg commented 3 months ago

Are there any plans to switch to toml for polldevs?

I do not se a real reason for not changing to toml, but there are functionallity that needs to be handled specially.. eg. "hierarchical" settings.. defaults etc..

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

johannaengland commented 3 months ago

I think we can live with one line not covered by tests :grin:

lunkwill42 commented 3 months ago

Are there any plans to switch to toml for polldevs?

No plans, but it should definitely be considered for post-2.0. Reading the original polldevs.cf was the first code implemented for Zino 2, since the file is potentially huge and we didn't want to force users to rewrite. As Johanna said, please feel free to post a feature request (if Runar didn't already)