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: fix --apply when the desired deployment is already staged #256

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
.unwrap_or_default();
if staged_unchanged {
println!("Staged update present, not changed.");

if opts.apply {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm....I need to think about this. Is it that simple? Yeah, I think that will work. I'm OK with this though I do wonder if we should basically set changed=true in this case instead and just fall through.

If we do that, then maybe the changed variable is misnamed and it's really just bool have_staged.

(BTW we should probably drop --touch-if-changed since I think it's better done by querying the status API)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW I had the same reaction once I wrapped my head around things (is it this simple??). Agreed with everything else you said though. My only other thought was the bit in the help on --apply re: "In the future this command will detect the case where no kernel changes are queued, and perform a userspace-only restart." which will require some additional rearranging of things. Maybe we just leave it for now and then it'll shake out in that future reorganization.

crate::reboot::reboot()?;
}
} else if booted_unchanged {
println!("No update available.")
} else {
Expand Down