@@ -11,6 +11,7 @@ macro_rules! println_flush {
1111
1212use crate :: { btrfs, lvm, prompt, users:: get_all_users_keys} ;
1313use anyhow:: { ensure, Context , Result } ;
14+ use fn_error_context:: context;
1415
1516use crossterm:: event:: { self , Event } ;
1617use std:: time:: Duration ;
@@ -19,6 +20,7 @@ const NO_SSH_PROMPT: &str = "None of the users on this system found have authori
1920 if your image doesn't use cloud-init or other means to set up users, \
2021 you may not be able to log in after reinstalling. Do you want to continue?";
2122
23+ #[ context( "prompt_single_user" ) ]
2224fn prompt_single_user ( user : & crate :: users:: UserKeys ) -> Result < Vec < & crate :: users:: UserKeys > > {
2325 let prompt = indoc:: formatdoc! {
2426 "Found only one user ({user}) with {num_keys} SSH authorized keys.
@@ -32,6 +34,7 @@ fn prompt_single_user(user: &crate::users::UserKeys) -> Result<Vec<&crate::users
3234 Ok ( if answer { vec ! [ & user] } else { vec ! [ ] } )
3335}
3436
37+ #[ context( "prompt_user_selection" ) ]
3538fn prompt_user_selection (
3639 all_users : & [ crate :: users:: UserKeys ] ,
3740) -> Result < Vec < & crate :: users:: UserKeys > > {
@@ -55,6 +58,7 @@ fn prompt_user_selection(
5558 . collect ( ) )
5659}
5760
61+ #[ context( "reboot" ) ]
5862pub ( crate ) fn reboot ( ) -> Result < ( ) > {
5963 let delay_seconds = 10 ;
6064 println_flush ! (
@@ -79,6 +83,7 @@ pub(crate) fn reboot() -> Result<()> {
7983
8084/// Temporary safety mechanism to stop devs from running it on their dev machine. TODO: Discuss
8185/// final prompting UX in https://github.com/bootc-dev/bootc/discussions/1060
86+ #[ context( "temporary_developer_protection_prompt" ) ]
8287pub ( crate ) fn temporary_developer_protection_prompt ( ) -> Result < ( ) > {
8388 // Print an empty line so that the warning stands out from the rest of the output
8489 println_flush ! ( ) ;
@@ -94,6 +99,7 @@ pub(crate) fn temporary_developer_protection_prompt() -> Result<()> {
9499 Ok ( ( ) )
95100}
96101
102+ #[ context( "ask_yes_no" ) ]
97103pub ( crate ) fn ask_yes_no ( prompt : & str , default : bool ) -> Result < bool > {
98104 dialoguer:: Confirm :: new ( )
99105 . with_prompt ( prompt)
@@ -114,6 +120,7 @@ pub(crate) fn press_enter() {
114120 }
115121}
116122
123+ #[ context( "mount_warning" ) ]
117124pub ( crate ) fn mount_warning ( ) -> Result < ( ) > {
118125 let mut mounts = btrfs:: check_root_siblings ( ) ?;
119126 mounts. extend ( lvm:: check_root_siblings ( ) ?) ;
@@ -138,6 +145,7 @@ pub(crate) fn mount_warning() -> Result<()> {
138145/// The keys are stored in a temporary file which is passed to
139146/// the podman run invocation to be used by
140147/// `bootc install to-existing-root --root-ssh-authorized-keys`
148+ #[ context( "get_ssh_keys" ) ]
141149pub ( crate ) fn get_ssh_keys ( temp_key_file_path : & str ) -> Result < ( ) > {
142150 let users = get_all_users_keys ( ) ?;
143151 if users. is_empty ( ) {
0 commit comments