-
Notifications
You must be signed in to change notification settings - Fork 3
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
Improve server logic #235
Merged
+667
−736
Merged
Improve server logic #235
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9c3a455
Use list of bioses instead of a specific bios
nadzyah 5eb90b0
Don't check board version
nadzyah b6ee1da
Add ' LTS' to release version string if it's an LTS release
nadzyah 5a3c7d3
Log information mismatch in case of not certified response
nadzyah ebd403c
Update tests to cover previous patches
nadzyah a88f2ad
Remove LTS suffix while importing data from C3 instead of adding it w…
nadzyah b5d342f
Add CertificationRequest generator to simplify tests
nadzyah 12cfe74
Update server dependencies
nadzyah 70a7a44
Split find_main_hardware_components method into find_board and find_b…
nadzyah 3b7e775
Add assertion methods to the CertificationStatusTestHelper class to m…
nadzyah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Log information mismatch in case of not certified response
commit 5a3c7d34168d08d865ceddbd8955fb3cca3fa754
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
# Nadzeya Hutsko <[email protected]> | ||
"""The endpoints for working with certification status""" | ||
|
||
|
||
import logging | ||
from fastapi import APIRouter, Depends | ||
from sqlalchemy.orm import Session | ||
|
||
|
@@ -61,6 +61,7 @@ def check_certification( | |
vendor = repository.get_vendor_by_name(db, system_info.vendor) | ||
if not vendor: | ||
return NotCertifiedResponse() | ||
|
||
# Match against board and bios | ||
try: | ||
board, bios_list = logic.find_main_hardware_components( | ||
|
@@ -70,16 +71,30 @@ def check_certification( | |
db, system_info.architecture, board, bios_list | ||
) | ||
except ValueError: | ||
logging.error( | ||
( | ||
"Hardware cannot be found. Machine vendor: %s, model: %s" | ||
", board model: %s, board version: %s, bios version: %s" | ||
), | ||
system_info.vendor, | ||
system_info.model, | ||
system_info.board.product_name, | ||
system_info.board.version, | ||
system_info.bios.version if system_info.bios else None, | ||
) | ||
return NotCertifiedResponse() | ||
|
||
bios = repository.get_machine_bios(db, related_machine.id) | ||
related_releases, kernels = repository.get_releases_and_kernels_for_machine( | ||
db, related_machine.id | ||
) | ||
|
||
# Match against CPU codename | ||
if not logic.check_cpu_compatibility(db, related_machine, system_info.processor): | ||
return response_builders.build_related_certified_response( | ||
db, related_machine, board, bios, related_releases, kernels | ||
) | ||
|
||
# Check OS release | ||
release_from_request = repository.get_release_object( | ||
db, system_info.os.version, system_info.os.codename | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This endpoint checks whether a hardware is certified or not. If it's not certified then it responds with
NotCertifiedResponse
. If so then it is expected behavior to find not certified device where the board doesn't match for instance. Hence it's not an error. So perhaps it's not correct to log an error here. Additionally, this is the API any logs made here are not shown to the client so we shouldn't be logging anything apart from real errors, warnings or perhaps debug info.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.
Matias specifically asked for logging hardware mismatch data since we'll probably have to adjust the logic according to, for instance, how many certified machines run a newer bios version, different from which we used for issuing a certificate
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.
This sounds like we need to store this data to be able to query it rather than just log it. I'm not sure if simply logging will help us get such information. @mz2 wdyt?
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.
Fair point, it probably is better that way. I was imagining deriving metrics from logs, but explicitly storing the full data is probably a better idea.
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.
After discussing it with @omar-selo, we've decided to add this change in another PR and create a table for storing hardware mismatches
Here is the Jira ticket for it: https://warthogs.atlassian.net/browse/C3-945