-
Notifications
You must be signed in to change notification settings - Fork 192
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
[health-check] Refactor the config usage #9662
[health-check] Refactor the config usage #9662
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 the PR, looks good! We're moving towards https://www.youtube.com/watch?v=1__lNTlj1_w and I like it 😄
I left a few questions and suggestions inline.
except (AttributeError, ValueError): | ||
res = None |
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.
Does it make sense to turn access errors into None
? This might silence errors caused by bad callers (or bad configs)
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.
So you'd prefer we let the caller deal with the error in case it asks for non-existent value? In my mind, when you ask a config for a non-existent prop, the correct behavior is to return a non-existent value (i.e. None
).
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.
The caller always needs to deal with the case that it asks for something from the config that can't be found (load_prop(x)
returns None
).
The question is: do we force the caller to deal with it by raising an exception or are we okay with the caller ignoring that? Both ways are okay, but since we don't have any config validation, it might make sense to not silence lookup errors (e.g. because the config is incomplete and mandatory values are missing) at runtime
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.
Ack, makes sense. Fixed - instead of silencing the error, we are now explicit as to the input we wanted to get, where we failed, and the state of config.
ecc3e8c
into
uyuni-project:health-check-skeleton
What does this PR change?
In this PR, I'm refactoring the config usage in the health check tool such that:
.toml
conf file instead of.ini
fileNOTE This is a PR into a feature branch, not the main branch.
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test
(see below)Re-run a test
If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:
Before you merge
Check How to branch and merge properly!