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

efi: sync bootentry label with Anaconda #685

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

HuijingHei
Copy link
Member

Read /etc/system-release if exists, else get NAME from /etc/os-release

See https://bugzilla.redhat.com/show_bug.cgi?id=2268505#c24

Read `/etc/system-release` if exists, else get `NAME` from `/etc/os-release`

See https://bugzilla.redhat.com/show_bug.cgi?id=2268505#c24
Copy link
Member

@cgwalters cgwalters left a 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()?;
Copy link
Member

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)

Copy link
Member

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.

Copy link
Member Author

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> {
Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

@cgwalters cgwalters merged commit eea4124 into coreos:main Jul 16, 2024
12 checks passed
@HuijingHei HuijingHei deleted the anaconda-label branch July 17, 2024 01:20
HuijingHei added a commit to HuijingHei/bootupd that referenced this pull request Jul 17, 2024
HuijingHei added a commit to HuijingHei/bootupd that referenced this pull request Jul 17, 2024
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.

2 participants