Skip to content

Commit ae5f6bc

Browse files
committed
upgrade: Add error message when staged deployment is incompatible
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 <[email protected]>
1 parent 1c5ad72 commit ae5f6bc

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lib/src/cli.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,17 +384,26 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
384384
crate::status::get_status_require_booted(sysroot)?;
385385
let imgref = host.spec.image.as_ref();
386386
// If there's no specified image, let's be nice and check if the booted system is using rpm-ostree
387-
if imgref.is_none()
388-
&& host
387+
if imgref.is_none() {
388+
let booted_incompatible = host
389389
.status
390390
.booted
391391
.as_ref()
392-
.map_or(false, |b| b.incompatible)
393-
{
394-
return Err(anyhow::anyhow!(
395-
"Booted deployment contains local rpm-ostree modifications; cannot upgrade via bootc. You can run `rpm-ostree reset` to undo the modifications."
396-
));
392+
.map_or(false, |b| b.incompatible);
393+
394+
let staged_incompatible = host
395+
.status
396+
.staged
397+
.as_ref()
398+
.map_or(false, |b| b.incompatible);
399+
400+
if booted_incompatible || staged_incompatible {
401+
return Err(anyhow::anyhow!(
402+
"Deployment contains local rpm-ostree modifications; cannot upgrade via bootc. You can run `rpm-ostree reset` to undo the modifications."
403+
));
404+
}
397405
}
406+
398407
let spec = RequiredHostSpec::from_spec(&host.spec)?;
399408
let booted_image = host
400409
.status

0 commit comments

Comments
 (0)