Skip to content

Commit

Permalink
Merge pull request #1178 from jlebon/pr/override-interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebon authored Apr 26, 2024
2 parents 495cd1c + 555b154 commit fe2db96
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/update_agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use serde::{Deserialize, Deserializer};
use std::cell::Cell;
use std::collections::BTreeSet;
use std::fs;
use std::path::Path;
use std::rc::Rc;
use std::time::Duration;
use tokio::sync::RwLock;
Expand All @@ -37,6 +38,10 @@ const DEFAULT_POSTPONEMENT_TIME_SECS: u64 = 60; // 1 minute.
/// before abandoning a target update.
const MAX_DEPLOY_ATTEMPTS: u8 = 12;

/// This is undocumented; it's for testing Zincati in e.g. cosa where you have
/// an interactive session but you don't want to wait for the full timeout.
const INTERACTIVE_SESSION_OVERRIDE: &str = "/run/zincati/override-interactive-check";

/// Maximum number of postponements to finalizing an update in the
/// `UpdateStaged` state before forcing an update finalization and reboot.
pub(crate) const MAX_FINALIZE_POSTPONEMENTS: u8 = 10;
Expand Down Expand Up @@ -284,6 +289,15 @@ impl UpdateAgentMachineState {
return true;
}

// Allow even with interactive sessions if we're overriding this check
if Path::new(INTERACTIVE_SESSION_OVERRIDE).exists() {
log::debug!(
"ignoring interactive sessions due to {}",
INTERACTIVE_SESSION_OVERRIDE
);
return true;
}

let (release, postponements_remaining) = match self {
UpdateAgentMachineState::UpdateStaged((r, p)) => (r, *p),
_ => unreachable!(
Expand Down

0 comments on commit fe2db96

Please sign in to comment.