Qualify tenant-scoped bootstrap rotation and fresh Windows scripting
This commit is contained in:
@@ -60,14 +60,8 @@ pub const WINDOWS_UPDATE_SCRIPT_SHA256: &str =
|
||||
"0fa5f513a06b6cf902a3f9ac1989987642c181eedd6c305b3912771bd10f2ebf";
|
||||
pub const WINDOWS_UPDATE_MAX_SECONDS: u32 = 3600;
|
||||
pub const WINDOWS_UPDATE_LONG_CAPABILITY: &str = "script.windows_update.long/1";
|
||||
pub fn valid_windows_update_limit(
|
||||
limit: Option<u32>,
|
||||
profiles: Option<&[PrivilegedScriptProfile]>,
|
||||
) -> bool {
|
||||
limit.is_none_or(|seconds| {
|
||||
(121..=WINDOWS_UPDATE_MAX_SECONDS).contains(&seconds)
|
||||
&& profiles == Some(&[PrivilegedScriptProfile::FullMaintenanceV1][..])
|
||||
})
|
||||
pub fn valid_windows_update_limit(limit: Option<u32>) -> bool {
|
||||
limit.is_none_or(|seconds| (121..=WINDOWS_UPDATE_MAX_SECONDS).contains(&seconds))
|
||||
}
|
||||
/// Only the built-in template's final ASCII JSON object describes the host's
|
||||
/// restart state. Earlier lines can include per-update results and native titles.
|
||||
@@ -489,7 +483,7 @@ impl Action {
|
||||
let has = |cap: &str| capabilities.iter().any(|c| c == cap);
|
||||
if !has(self.name())
|
||||
|| (self.full_maintenance()
|
||||
&& !(has(FULL_MAINTENANCE_CAPABILITY)
|
||||
&& !((has(FULL_MAINTENANCE_CAPABILITY) || (self.is_windows_update_template() && has(WINDOWS_UPDATE_LONG_CAPABILITY)))
|
||||
&& has("rmm.sync.v1")
|
||||
&& has(&format!("{}:run_script", identity))
|
||||
&& has(if identity == "root" {
|
||||
@@ -843,7 +837,7 @@ mod tests {
|
||||
None
|
||||
);
|
||||
assert_eq!(windows_update_reboot_report(b"partial"), None);
|
||||
assert!(!valid_windows_update_limit(Some(3600), None));
|
||||
assert!(!valid_windows_update_limit(Some(3601)));
|
||||
}
|
||||
#[test]
|
||||
fn windows_system_scm_is_explicit_and_preserves_linux_service_bytes() {
|
||||
|
||||
Reference in New Issue
Block a user