windows update, use explicit reboot policy (#1143)

This commit is contained in:
Sam Hug
2025-07-14 00:57:00 -07:00
committed by GitHub
parent f8c910a3c2
commit 1114556661
3 changed files with 29 additions and 0 deletions

View File

@@ -235,10 +235,20 @@ pub struct Vagrant {
always_suspend: Option<bool>,
}
#[derive(Deserialize, Default, Debug, Copy, Clone)]
#[serde(rename_all = "snake_case")]
pub enum UpdatesAutoReboot {
Yes,
#[default]
No,
Ask,
}
#[derive(Deserialize, Default, Debug, Merge)]
#[serde(deny_unknown_fields)]
pub struct Windows {
accept_all_updates: Option<bool>,
updates_auto_reboot: Option<UpdatesAutoReboot>,
self_rename: Option<bool>,
open_remotes_in_new_terminal: Option<bool>,
wsl_update_pre_release: Option<bool>,
@@ -1219,6 +1229,15 @@ impl Config {
.unwrap_or(true)
}
/// Whether to auto reboot for Windows updates that require it
pub fn windows_updates_auto_reboot(&self) -> UpdatesAutoReboot {
self.config_file
.windows
.as_ref()
.and_then(|windows| windows.updates_auto_reboot)
.unwrap_or_default()
}
/// Whether to self rename the Topgrade executable during the run
pub fn self_rename(&self) -> bool {
self.config_file