Skip to content

Commit a15090b

Browse files
authored
Merge pull request bootc-dev#600 from ckyrouac/staged-upgrade-error
upgrade: Add error message when staged deployment is incompatible
2 parents 270ed92 + ae5f6bc commit a15090b

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)