File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,11 +200,12 @@ pub(crate) struct SwitchOpts {
200200 pub ( crate ) unified_storage_exp : bool ,
201201
202202 /// Target image to use for the next boot.
203+ /// Required unless `--from-downloaded` is present.
203204 #[ clap(
204- required_unless_present = "from-downloaded " ,
205- conflicts_with = "from-downloaded "
205+ required_unless_present = "from_downloaded " ,
206+ conflicts_with = "from_downloaded "
206207 ) ]
207- pub ( crate ) target : String ,
208+ pub ( crate ) target : Option < String > ,
208209
209210 #[ clap( flatten) ]
210211 pub ( crate ) progress : ProgressOptions ,
@@ -1434,11 +1435,17 @@ async fn upgrade(
14341435
14351436 Ok ( ( ) )
14361437}
1438+
1439+ #[ context( "Getting imgref for switch" ) ]
14371440pub ( crate ) fn imgref_for_switch ( opts : & SwitchOpts ) -> Result < ImageReference > {
14381441 let transport = ostree_container:: Transport :: try_from ( opts. transport . as_str ( ) ) ?;
14391442 let imgref = ostree_container:: ImageReference {
14401443 transport,
1441- name : opts. target . to_string ( ) ,
1444+ name : opts
1445+ . target
1446+ . as_ref ( )
1447+ . ok_or_else ( || anyhow ! ( "Target image not found" ) ) ?
1448+ . to_string ( ) ,
14421449 } ;
14431450 let sigverify = sigpolicy_from_opt ( opts. enforce_container_sigpolicy ) ;
14441451 let target = ostree_container:: OstreeImageReference { sigverify, imgref } ;
Original file line number Diff line number Diff line change @@ -39,9 +39,7 @@ Soft reboot allows faster system restart by avoiding full hardware reboot when p
3939<!-- BEGIN GENERATED OPTIONS -->
4040** TARGET**
4141
42- Target image to use for the next boot
43-
44- This argument is required.
42+ Target image to use for the next boot. Required unless `--from-downloaded` is present
4543
4644** --quiet**
4745
You can’t perform that action at this time.
0 commit comments