feat: add approval bound full maintenance script console and executors
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -13,6 +13,12 @@ pub fn socket_for(
|
||||
general: Option<OsString>,
|
||||
apt: Option<OsString>,
|
||||
) -> Result<PathBuf> {
|
||||
if job.action.full_maintenance() {
|
||||
return Ok(PathBuf::from(
|
||||
std::env::var_os("RMM_FULL_MAINTENANCE_HELPER_SOCKET")
|
||||
.context("FULL_MAINTENANCE_SOCKET_NOT_CONFIGURED")?,
|
||||
));
|
||||
}
|
||||
select_socket(provider::is_apt_action(job), general, apt)
|
||||
}
|
||||
fn select_socket(
|
||||
@@ -216,6 +222,23 @@ pub fn invoke(binding: &Binding, job: &JobPayload, request: &Request) -> Result<
|
||||
rmm_privileged_helper::invoke(&socket, request, job.max_runtime_seconds)
|
||||
}
|
||||
|
||||
pub fn invoke_with_control(
|
||||
binding: &Binding,
|
||||
job: &JobPayload,
|
||||
request: &Request,
|
||||
observe: impl FnMut() -> Result<()>,
|
||||
) -> Result<Outcome> {
|
||||
if !job.action.full_maintenance() {
|
||||
return invoke(binding, job, request);
|
||||
}
|
||||
ensure!(
|
||||
crate::helper_sync::general_supported(binding, job),
|
||||
"FULL_MAINTENANCE_POLICY_REQUIRED"
|
||||
);
|
||||
let socket = socket_for(job, None, None)?;
|
||||
rmm_privileged_helper::invoke_controlled(&socket, request, job.max_runtime_seconds, observe)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -354,6 +377,7 @@ mod tests {
|
||||
arguments: vec![],
|
||||
expected_stdout: None,
|
||||
windows_execution_profile: None,
|
||||
privileged_script_profile: None,
|
||||
},
|
||||
execution_identity: "root".into(),
|
||||
not_before: now,
|
||||
|
||||
Reference in New Issue
Block a user