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

status: Introduce tool to quickly check if we are booted as default #3134

Merged
merged 3 commits into from Jan 8, 2024

Conversation

ericcurtin
Copy link
Collaborator

@ericcurtin ericcurtin commented Jan 5, 2024

Generally in ostree based systems you would expect to boot into deployment 0, in rollback conditions triggered by greenboot-related rollbacks this might not be the case. This is a tool to detect this.

@ericcurtin ericcurtin force-pushed the query-boot-real branch 3 times, most recently from debcd8d to 6b50dfb Compare January 5, 2024 17:29
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.

Overall LGTM, one bug and some nits. Thanks for this!

man/ostree-admin-status.xml Outdated Show resolved Hide resolved
src/ostree/ot-admin-builtin-status.c Outdated Show resolved Hide resolved
src/ostree/ot-admin-builtin-status.c Outdated Show resolved Hide resolved
Generally in ostree based systems you would expect to boot into
deployment 0, in rollback conditions triggered by greenboot-related
rollbacks this might not be the case. This is a tool to detect this.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Document the various CLI options.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
It was a copy-paste of another description, rather than it's own.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
@ericcurtin
Copy link
Collaborator Author

This one is ready for re-review @cgwalters I believe everything is addressed

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.

I think an integration test for the default case would be easy to add, but we can also do that after. Thanks for the work here!

@cgwalters cgwalters merged commit b79a2e1 into ostreedev:main Jan 8, 2024
24 checks passed
</varlistentry>

<varlistentry>
<term><option>--version</option>--version</term>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the syntax correct here?

NULL },
{ "skip-signatures", 'S', 0, G_OPTION_ARG_NONE, &opt_skip_signatures, "Skip signatures in output",
NULL },
{ "query-booted", 'Q', 0, G_OPTION_ARG_NONE, &opt_query_booted,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pure bikeshed, but I think this would be better named e.g. --is-default. Somewhat precedence are the systemctl is-* commands that also print strings. --query-booted is a bit ambiguous.

"Output the string \"default\" if the default deployment is the booted one, \"not-default\" if "
"we are booted in a non-default deployment (e.g. the user interactively chose a different "
"entry in the bootloader menu, or the bootloader rolled back automatically, etc.). If we are "
"not in a booted OSTree system, an error is returned.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this is duplicating the manpage. These docstrings are usually more brief. Maybe e.g.

Output "default" if booted into the default deployment, otherwise "not-default"

?

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.

None yet

3 participants