Keep legacy Windows starter worker pins outside official GNU enrollments

This commit is contained in:
2026-11-18 11:03:55 +01:00
parent 07154833b3
commit 0b07baf7be
4 changed files with 16 additions and 8 deletions
+7 -2
View File
@@ -23,6 +23,11 @@ struct TenantPins { current: Pin, previous: Vec<Previous> }
#[serde(deny_unknown_fields)]
pub(super) struct UpdaterQuery { platform: Platform, sha256: Option<String> }
fn official_windows(platform: Platform) -> bool {
platform == Platform::WindowsGnuX64
&& std::env::var_os("RMM_AGENT_UPDATE_WINDOWS_GNU_OFFICIAL_KEYRING_FILE").is_some()
}
async fn config(s: &crate::State, platform: Platform, tenant: Uuid, wanted: Option<&str>) -> Result<Config, Error> {
let slot = match platform {
Platform::LinuxX64 => "RMM_AGENT_BOOTSTRAP_LINUX_FILE",
@@ -45,8 +50,8 @@ async fn config(s: &crate::State, platform: Platform, tenant: Uuid, wanted: Opti
config.updater_bytes = selected.bytes;
} else {
let mut tx = rmm_persistence::tenant_tx(&s.pool, tenant).await?;
let pin = sqlx::query("SELECT sha256,size_bytes FROM customer_starter_workers WHERE platform=$1")
.bind(platform_name(platform)).fetch_optional(&mut *tx).await?;
let pin = sqlx::query("SELECT sha256,size_bytes FROM customer_starter_workers WHERE platform=$1 AND official_windows=$2")
.bind(platform_name(platform)).bind(official_windows(platform)).fetch_optional(&mut *tx).await?;
tx.commit().await?;
if let Some(pin) = pin {
config.updater_sha256 = pin.get("sha256");