Add reviewed Windows scope completion and idle certificate renewal; deploy completion API
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -26,6 +26,8 @@ const PROBE_FILE: &str = "helper-probe.json";
|
||||
pub struct Client {
|
||||
pin: ipc::Pin,
|
||||
lane: Arc<Semaphore>,
|
||||
qualified_capabilities: Vec<String>,
|
||||
probed_at: Option<std::time::Instant>,
|
||||
}
|
||||
pub struct ControlSnapshot {
|
||||
pub raw: Snapshot,
|
||||
@@ -73,7 +75,7 @@ impl Client {
|
||||
"HELPER_JOB_BINDING_MISMATCH"
|
||||
);
|
||||
}
|
||||
Ok(Some(Self { pin, lane }))
|
||||
Ok(Some(Self { pin, lane, qualified_capabilities:vec![], probed_at:None }))
|
||||
}
|
||||
pub async fn refresh(
|
||||
agent_id: String,
|
||||
@@ -89,8 +91,8 @@ impl Client {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let _permit = permit;
|
||||
let result=(|| {
|
||||
let client=Self::discover(&agent_id,&asset_id,binding.as_ref(),lane).context(ipc::Stage::DiscoverPin)?;
|
||||
if let Some(client)=&client {client.probe_blocking(&state)?;}
|
||||
let mut client=Self::discover(&agent_id,&asset_id,binding.as_ref(),lane).context(ipc::Stage::DiscoverPin)?;
|
||||
if let Some(client)=&mut client {client.probe_blocking(&state)?;}
|
||||
Ok(client)
|
||||
})();
|
||||
if result.is_err() || matches!(&result,Ok(None)) && state.join(PROBE_FILE).try_exists()? {
|
||||
@@ -338,7 +340,7 @@ impl Client {
|
||||
})
|
||||
.await?
|
||||
}
|
||||
fn probe_blocking(&self, state: &Path) -> Result<()> {
|
||||
fn probe_blocking(&mut self, state: &Path) -> Result<()> {
|
||||
self.check_pin().context(ipc::Stage::DiscoverPin)?;
|
||||
let pin = &self.pin;
|
||||
let call = ipc::Call::new(pin, ipc::Operation::Probe {});
|
||||
@@ -357,8 +359,16 @@ impl Client {
|
||||
};
|
||||
let value = json!({"schema_version":1,"source":"actual_local_service_runtime","agent_process_id":std::process::id(),"agent_service":crate::SERVICE_NAME,"agent_id":pin.binding.agent_id,"asset_id":pin.binding.asset_id,"challenge":reply.challenge,"observed_at":chrono::Utc::now(),"helper_service":ipc::HELPER_SERVICE,"verified_helper_user_sid":pin.helper.user_sid,"verified_helper_service_sid":pin.helper.service_sid,"helper_binary_sha256":reply.helper_binary_sha256,"policy_sha256":reply.policy_sha256,"authenticated_pipe_exchange":true,"client_service_pid_verified_by_helper":true,"ledger_file_id":ledger,"executor_lock_file_id":lock,"helper_clock_qualified":clock_qualified,"helper_ready":ready,"system_capability_advertised":false,"no_jobs":true});
|
||||
self.check_pin()?;
|
||||
self.qualified_capabilities=crate::system_capabilities::qualified(pin,clock_qualified)?;
|
||||
self.probed_at=Some(std::time::Instant::now());
|
||||
let mut value=value;
|
||||
value["system_capability_advertised"]=json!(!self.qualified_capabilities.is_empty());
|
||||
value["qualified_capabilities"]=json!(self.qualified_capabilities);
|
||||
write_current_probe(state, &value).context(ipc::Stage::ClientReport)
|
||||
}
|
||||
pub fn qualified_capabilities(&self) -> Vec<String> {
|
||||
if self.probed_at.is_some_and(|at|at.elapsed()<=Duration::from_secs(90)) {self.qualified_capabilities.clone()} else {vec![]}
|
||||
}
|
||||
/// Pure admission shape only; no capability or qualification is asserted.
|
||||
pub fn supports_system(&self, job: &JobPayload) -> bool {
|
||||
system_shape(job)
|
||||
|
||||
Reference in New Issue
Block a user