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

upgrade: Add error message when staged deployment is incompatible #600

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

ckyrouac
Copy link
Contributor

When running rpm-ostree install <package> without a reboot, bootc upgrade will fail. Prior to this, the error message was unclear of the cause.

fixes RHEL-36003

lib/src/cli.rs Outdated
));
}

if host.status.staged.is_some()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should be able to drop this part; I know Rust combinators can be quite obscure but it's basically what the map_or(false) is doing here...if the option is None, then the result will be false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 thanks for the tip

lib/src/cli.rs Outdated
Comment on lines 400 to 404
&& host
.status
.staged
.as_ref()
.map_or(false, |b| b.incompatible)
Copy link
Collaborator

Choose a reason for hiding this comment

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

But for a bigger cleanup, I think we can merge the logic for checking something like this:

let booted_incompatible = host
            .status
            .booted
            .as_ref()
            .map_or(false, |b| b.incompatible);
let staged_incompatible = host
                .status
                .staged
                .as_ref()
                .map_or(false, |b| b.incompatible);
if booted_incompatible || staged_incompatible {
   return Err...
}

or so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, updated

When running `rpm-ostree install <package>` without a reboot, `bootc
upgrade` will fail. Prior to this, the error message was unclear of the
cause.

fixes RHEL-36003

Signed-off-by: Chris Kyrouac <ckyrouac@redhat.com>
Copy link
Collaborator

@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!

@cgwalters cgwalters merged commit a15090b into containers:main Jun 13, 2024
12 of 16 checks passed
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