Skip to content

Commit b075e03

Browse files
committed
switch: Move option processing earlier
This logic just converts the provided CLI options into data structures, so it can come before we do other things. Prep for further work. Signed-off-by: Colin Walters <[email protected]>
1 parent 0c47374 commit b075e03

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/src/cli.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,6 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
386386
/// Implementation of the `bootc switch` CLI command.
387387
#[context("Switching")]
388388
async fn switch(opts: SwitchOpts) -> Result<()> {
389-
prepare_for_write().await?;
390-
let cancellable = gio::Cancellable::NONE;
391-
392-
let sysroot = &get_locked_sysroot().await?;
393-
let repo = &sysroot.repo();
394-
let (booted_deployment, _deployments, host) =
395-
crate::status::get_status_require_booted(sysroot)?;
396-
397389
let transport = ostree_container::Transport::try_from(opts.transport.as_str())?;
398390
let imgref = ostree_container::ImageReference {
399391
transport,
@@ -406,6 +398,14 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
406398
let target = ostree_container::OstreeImageReference { sigverify, imgref };
407399
let target = ImageReference::from(target);
408400

401+
prepare_for_write().await?;
402+
let cancellable = gio::Cancellable::NONE;
403+
404+
let sysroot = &get_locked_sysroot().await?;
405+
let repo = &sysroot.repo();
406+
let (booted_deployment, _deployments, host) =
407+
crate::status::get_status_require_booted(sysroot)?;
408+
409409
let new_spec = {
410410
let mut new_spec = host.spec.clone();
411411
new_spec.image = Some(target.clone());

0 commit comments

Comments
 (0)