-
Notifications
You must be signed in to change notification settings - Fork 22
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
efi: sync bootentry label with Anaconda #685
Conversation
Read `/etc/system-release` if exists, else get `NAME` from `/etc/os-release` See https://bugzilla.redhat.com/show_bug.cgi?id=2268505#c24
9e5a333
to
47557c3
Compare
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.
Thanks! Looks sane, just one minor nit.
@@ -659,4 +670,10 @@ Boot0003* test"; | |||
); | |||
Ok(()) | |||
} | |||
#[test] | |||
fn test_get_product_name() -> Result<()> { | |||
let name = get_product_name()?; |
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.
I think we shouldn't read global state in a unit test. This will fail on e.g. Debian or other systems and we want to support those.
We can unit test parsing from a &str
easily enough though.
(That said of course, we could use openat or better cap-std to load from a test root...see what we do in https://github.com/containers/bootc/blob/c866bba1e96e912ab2e36b9eec3985e93e7a0c9b/lib/src/generator.rs#L90 - but unfortunately OsRelease
doesn't support that yet)
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 will fail on e.g. Debian or other systems and we want to support those.
I was wrong, it shouldn't because the system-release
is optional.
However, it does still make sense to avoid reading global state longer term.
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.
Thanks! Yes, you are correct, will switch to os-release
if not exist system-release
.
} | ||
} | ||
|
||
#[context("Get product name")] | ||
fn get_product_name() -> Result<String> { |
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.
Should this change to fn get_product_name(root: &Dir)
to pass root dir as parameter?
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.
Yeah, but not a blocker, just a nice to have IMO.
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.
Thanks, will update in the later PR.
Read
/etc/system-release
if exists, else getNAME
from/etc/os-release
See https://bugzilla.redhat.com/show_bug.cgi?id=2268505#c24