Share signed job core and verify native Linux then Windows contracts
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -262,11 +262,11 @@ pub async fn permit(
|
||||
};
|
||||
let payload: JobPayload = serde_json::from_slice(&row.get::<Vec<u8>, _>("payload"))?;
|
||||
let plan: PlanPayload = serde_json::from_slice(&row.get::<Vec<u8>, _>("plan_payload"))?;
|
||||
let capabilities: Value = row.get("capabilities");
|
||||
let capabilities: Vec<String> = serde_json::from_value(row.get("capabilities"))?;
|
||||
if row.get::<Uuid, _>("bound_asset") != payload.asset_id
|
||||
|| !capabilities
|
||||
.as_array()
|
||||
.is_some_and(|c| c.iter().any(|v| v.as_str() == Some(payload.action.name())))
|
||||
|| !payload
|
||||
.action
|
||||
.available_for(&payload.execution_identity, &capabilities)
|
||||
|| hash(&row.get::<Vec<u8>, _>("plan_payload")) != row.get::<String, _>("plan_hash")
|
||||
|| !plan.jobs.iter().any(|j| {
|
||||
j.payload.job_id == payload.job_id
|
||||
@@ -491,11 +491,20 @@ pub async fn next(
|
||||
if let Some(r)=sqlx::query("SELECT job_id,attempt_id FROM jobs WHERE agent_id=$1 AND cancel_requested AND state IN ('accepted','running','verifying','awaiting_reboot') ORDER BY job_id LIMIT 1").bind(agent).fetch_optional(&mut *tx).await?{
|
||||
tx.commit().await?;return Ok(Some(Payload::CancelRequest(CancelRequest{job_id:r.get::<Uuid,_>("job_id").to_string(),attempt_id:r.get::<Uuid,_>("attempt_id").to_string(),reason:"operator_cancel_requested".into()})))
|
||||
}
|
||||
let row=sqlx::query("SELECT j.job_id,j.attempt_id,j.payload,j.payload_hash,a.authorization_id,p.plan_hash FROM outbox b JOIN jobs j USING(tenant_id,job_id,attempt_id) JOIN operations o ON o.tenant_id=j.tenant_id AND o.operation_id=j.operation_id JOIN authorizations a ON a.tenant_id=o.tenant_id AND a.authorization_id=o.authorization_id JOIN approval_requests r ON r.tenant_id=j.tenant_id AND r.operation_id=j.operation_id JOIN operation_plans p ON p.tenant_id=j.tenant_id AND p.plan_id=r.plan_id JOIN tenants t ON t.tenant_id=j.tenant_id WHERE j.agent_id=$1 AND j.state='queued' AND NOT j.cancel_requested AND NOT t.changes_stopped AND a.revoked_at IS NULL AND r.approval_state='approved' AND p.expires_at>now() AND b.acknowledged_at IS NULL AND (b.lease_until IS NULL OR b.lease_until<now()) ORDER BY j.job_id FOR UPDATE OF b SKIP LOCKED LIMIT 1").bind(agent).fetch_optional(&mut *tx).await?;
|
||||
let row=sqlx::query("SELECT j.job_id,j.attempt_id,j.payload,j.payload_hash,a.authorization_id,p.plan_hash,i.capabilities FROM outbox b JOIN jobs j USING(tenant_id,job_id,attempt_id) JOIN operations o ON o.tenant_id=j.tenant_id AND o.operation_id=j.operation_id JOIN authorizations a ON a.tenant_id=o.tenant_id AND a.authorization_id=o.authorization_id JOIN approval_requests r ON r.tenant_id=j.tenant_id AND r.operation_id=j.operation_id JOIN operation_plans p ON p.tenant_id=j.tenant_id AND p.plan_id=r.plan_id JOIN tenants t ON t.tenant_id=j.tenant_id JOIN agent_installations i ON i.tenant_id=j.tenant_id AND i.agent_id=j.agent_id WHERE j.agent_id=$1 AND j.state='queued' AND NOT j.cancel_requested AND NOT t.changes_stopped AND a.revoked_at IS NULL AND r.approval_state='approved' AND p.expires_at>now() AND b.acknowledged_at IS NULL AND (b.lease_until IS NULL OR b.lease_until<now()) ORDER BY j.job_id FOR UPDATE OF b SKIP LOCKED LIMIT 1").bind(agent).fetch_optional(&mut *tx).await?;
|
||||
let Some(row) = row else {
|
||||
tx.commit().await?;
|
||||
return Ok(None);
|
||||
};
|
||||
let payload: JobPayload = serde_json::from_slice(&row.get::<Vec<u8>, _>("payload"))?;
|
||||
let caps: Vec<String> = serde_json::from_value(row.get("capabilities"))?;
|
||||
if !payload
|
||||
.action
|
||||
.available_for(&payload.execution_identity, &caps)
|
||||
{
|
||||
tx.commit().await?;
|
||||
return Ok(None);
|
||||
}
|
||||
sqlx::query("UPDATE outbox SET lease_until=now()+interval '30 seconds' WHERE job_id=$1")
|
||||
.bind(row.get::<Uuid, _>("job_id"))
|
||||
.execute(&mut *tx)
|
||||
|
||||
+303
-25
@@ -107,6 +107,8 @@ pub struct Rollout {
|
||||
pub struct PlanInput {
|
||||
pub targets: Targets,
|
||||
pub action: Action,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub script_variants: Vec<Variant>,
|
||||
pub execution_identity: String,
|
||||
pub schedule: Schedule,
|
||||
pub max_runtime_seconds: u32,
|
||||
@@ -144,7 +146,7 @@ struct WebSchedule {
|
||||
}
|
||||
#[derive(Clone, Deserialize, Serialize, schemars::JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Variant {
|
||||
pub struct Variant {
|
||||
os_family: String,
|
||||
interpreter: String,
|
||||
encoding: String,
|
||||
@@ -200,21 +202,17 @@ impl PlanRequest {
|
||||
|value: Option<String>| value.ok_or(Error(StatusCode::BAD_REQUEST, "VALIDATION_ERROR"));
|
||||
let action = match w.action.as_str() {
|
||||
"run_script" => {
|
||||
let mut variants = p
|
||||
let variants = p
|
||||
.variants
|
||||
.as_ref()
|
||||
.ok_or(Error(StatusCode::BAD_REQUEST, "VALIDATION_ERROR"))?;
|
||||
if variants.len() != 1 {
|
||||
return Err(fail("AMBIGUOUS_TARGET"));
|
||||
}
|
||||
let v = variants.remove(0);
|
||||
if v.os_family != "linux" || v.encoding != "utf-8" {
|
||||
return Err(fail("UNSUPPORTED_CAPABILITY"));
|
||||
}
|
||||
validate_variants(variants)?;
|
||||
let v = &variants[0];
|
||||
Action::RunScript {
|
||||
interpreter: v.interpreter,
|
||||
script_utf8: v.script_utf8,
|
||||
arguments: p.arguments.unwrap_or_default(),
|
||||
expected_stdout: p.expected_stdout,
|
||||
interpreter: v.interpreter.clone(),
|
||||
script_utf8: v.script_utf8.clone(),
|
||||
arguments: p.arguments.clone().unwrap_or_default(),
|
||||
expected_stdout: p.expected_stdout.clone(),
|
||||
}
|
||||
}
|
||||
"refresh_inventory" => Action::RefreshInventory {
|
||||
@@ -287,6 +285,7 @@ impl PlanRequest {
|
||||
Ok(PlanInput {
|
||||
targets: w.targets,
|
||||
action,
|
||||
script_variants: p.variants.unwrap_or_default(),
|
||||
execution_identity: p.execution_identity,
|
||||
schedule: Schedule {
|
||||
not_before: w.schedule.not_before,
|
||||
@@ -300,6 +299,71 @@ impl PlanRequest {
|
||||
})
|
||||
}
|
||||
}
|
||||
fn validate_variants(variants: &[Variant]) -> Result<()> {
|
||||
if variants.is_empty() || variants.len() > 2 {
|
||||
return Err(fail("AMBIGUOUS_TARGET"));
|
||||
}
|
||||
let mut platforms = std::collections::HashSet::new();
|
||||
for v in variants {
|
||||
let action = Action::RunScript {
|
||||
interpreter: v.interpreter.clone(),
|
||||
script_utf8: v.script_utf8.clone(),
|
||||
arguments: vec![],
|
||||
expected_stdout: None,
|
||||
};
|
||||
if v.encoding != "utf-8"
|
||||
|| action.script_platform() != Some(v.os_family.as_str())
|
||||
|| !action.validate()
|
||||
{
|
||||
return Err(fail("UNSUPPORTED_CAPABILITY"));
|
||||
}
|
||||
if !platforms.insert(v.os_family.as_str()) {
|
||||
return Err(fail("AMBIGUOUS_TARGET"));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
fn capabilities(value: Value) -> Result<Vec<String>> {
|
||||
serde_json::from_value(value).map_err(|_| fail("UNSUPPORTED_CAPABILITY"))
|
||||
}
|
||||
fn target_action(input: &PlanInput, caps: &[String]) -> Result<Action> {
|
||||
if input.script_variants.is_empty() {
|
||||
return Ok(input.action.clone());
|
||||
}
|
||||
validate_variants(&input.script_variants)?;
|
||||
let Action::RunScript {
|
||||
interpreter,
|
||||
script_utf8,
|
||||
arguments,
|
||||
expected_stdout,
|
||||
} = &input.action
|
||||
else {
|
||||
return Err(fail("VALIDATION_ERROR"));
|
||||
};
|
||||
let first = &input.script_variants[0];
|
||||
if interpreter != &first.interpreter || script_utf8 != &first.script_utf8 {
|
||||
return Err(fail("VALIDATION_ERROR"));
|
||||
}
|
||||
let platform = match (
|
||||
caps.iter().any(|c| c == "linux.base/1"),
|
||||
caps.iter().any(|c| c == "windows.base/1"),
|
||||
) {
|
||||
(true, false) => "linux",
|
||||
(false, true) => "windows",
|
||||
_ => return Err(fail("UNSUPPORTED_CAPABILITY")),
|
||||
};
|
||||
let v = input
|
||||
.script_variants
|
||||
.iter()
|
||||
.find(|v| v.os_family == platform)
|
||||
.ok_or_else(|| fail("UNSUPPORTED_CAPABILITY"))?;
|
||||
Ok(Action::RunScript {
|
||||
interpreter: v.interpreter.clone(),
|
||||
script_utf8: v.script_utf8.clone(),
|
||||
arguments: arguments.clone(),
|
||||
expected_stdout: expected_stdout.clone(),
|
||||
})
|
||||
}
|
||||
async fn policy(tx: &mut Transaction<'_, Postgres>) -> Result<()> {
|
||||
let stopped: bool = sqlx::query_scalar("SELECT changes_stopped FROM tenants")
|
||||
.fetch_one(&mut **tx)
|
||||
@@ -353,7 +417,7 @@ pub async fn plan(
|
||||
if matches!(input.action, Action::Reboot { .. }) && input.rollout.max_parallel != 1 {
|
||||
return Err(fail("POLICY_DENIED"));
|
||||
}
|
||||
let mut ids = input.targets.asset_ids;
|
||||
let mut ids = input.targets.asset_ids.clone();
|
||||
ids.sort();
|
||||
ids.dedup();
|
||||
let mut tx = rmm_persistence::tenant_tx(&state.pool, tenant).await?;
|
||||
@@ -384,11 +448,9 @@ pub async fn plan(
|
||||
}));
|
||||
}
|
||||
let row = &rows[0];
|
||||
let caps: Value = row.get("capabilities");
|
||||
if !caps
|
||||
.as_array()
|
||||
.is_some_and(|c| c.iter().any(|v| v.as_str() == Some(input.action.name())))
|
||||
{
|
||||
let caps = capabilities(row.get("capabilities"))?;
|
||||
let action = target_action(&input, &caps)?;
|
||||
if !action.available_for(&input.execution_identity, &caps) {
|
||||
return Err(fail("UNSUPPORTED_CAPABILITY"));
|
||||
}
|
||||
let payload = JobPayload {
|
||||
@@ -400,7 +462,7 @@ pub async fn plan(
|
||||
assignment_version: row.get::<i64, _>("assignment_version") as u64,
|
||||
job_id: Uuid::new_v4(),
|
||||
attempt_id: Uuid::new_v4(),
|
||||
action: input.action.clone(),
|
||||
action,
|
||||
execution_identity: input.execution_identity.clone(),
|
||||
not_before: input.schedule.not_before,
|
||||
start_before: input.schedule.start_before,
|
||||
@@ -530,13 +592,19 @@ async fn recheck(tx: &mut Transaction<'_, Postgres>, plan: &PlanPayload) -> Resu
|
||||
{
|
||||
return Err(fail("AUTHORIZATION_REVOKED"));
|
||||
}
|
||||
let caps: Value = r.get("capabilities");
|
||||
if !caps.as_array().is_some_and(|c| {
|
||||
c.iter()
|
||||
.any(|v| v.as_str() == Some(job.payload.action.name()))
|
||||
}) {
|
||||
let caps = capabilities(r.get("capabilities"))?;
|
||||
if !job
|
||||
.payload
|
||||
.action
|
||||
.available_for(&job.payload.execution_identity, &caps)
|
||||
{
|
||||
return Err(fail("UNSUPPORTED_CAPABILITY"));
|
||||
}
|
||||
if let Action::RunScript { script_utf8, .. } = &job.payload.action
|
||||
&& job.script_sha256.as_deref() != Some(hash(script_utf8.as_bytes()).as_str())
|
||||
{
|
||||
return Err(fail("PLAN_HASH_MISMATCH"));
|
||||
}
|
||||
if hash(&encode(&job.payload)?) != job.job_payload_hash {
|
||||
return Err(fail("PLAN_HASH_MISMATCH"));
|
||||
}
|
||||
@@ -921,3 +989,213 @@ async fn operations_http(
|
||||
json!({"items":items,"next_cursor":next,"completeness":if truncated{"partial"}else{"complete"},"truncated":truncated,"as_of":page.as_of}),
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod windows_contract_tests {
|
||||
use super::*;
|
||||
fn input() -> PlanInput {
|
||||
let tenant = Uuid::new_v4();
|
||||
let now = Utc::now();
|
||||
serde_json::from_value::<PlanRequest>(json!({"tenant_id":tenant,"action":"run_script","targets":{"asset_ids":[Uuid::new_v4()]},"parameters":{"execution_identity":"agent_service","timeout_seconds":60,"max_output_bytes":4096,"variants":[{"os_family":"linux","interpreter":"posix_sh","encoding":"utf-8","script_utf8":"printf hi\n"},{"os_family":"windows","interpreter":"powershell","encoding":"utf-8","script_utf8":"Write-Output 'hi'\r\n"}]},"schedule":{"not_before":now,"start_before":now+chrono::Duration::minutes(10),"offline_policy":"wait_until_deadline"},"rollout":{"max_parallel":1,"halt_after_failures":1},"reason":"fixed mixed plan"})).unwrap().resolve(tenant).unwrap()
|
||||
}
|
||||
#[test]
|
||||
fn exact_fixed_variants_and_typed_bypass_denials() {
|
||||
assert!(capabilities(json!(["windows.base/1", 42])).is_err());
|
||||
assert!(capabilities(json!({"run_script": true})).is_err());
|
||||
let mut i = input();
|
||||
let linux = target_action(&i, &["linux.base/1".into()]).unwrap();
|
||||
assert_eq!(linux, i.action);
|
||||
let windows = target_action(&i, &["windows.base/1".into()]).unwrap();
|
||||
assert_eq!(windows.script_platform(), Some("windows"));
|
||||
assert!(
|
||||
matches!(windows,Action::RunScript{ref script_utf8,..} if script_utf8.as_bytes()==b"Write-Output 'hi'\r\n")
|
||||
);
|
||||
assert!(target_action(&i, &[]).is_err());
|
||||
assert!(target_action(&i, &["linux.base/1".into(), "windows.base/1".into()]).is_err());
|
||||
i.script_variants.push(i.script_variants[0].clone());
|
||||
assert!(target_action(&i, &["linux.base/1".into()]).is_err());
|
||||
let mut i = input();
|
||||
i.script_variants[1].interpreter = "bash".into();
|
||||
assert!(target_action(&i, &["windows.base/1".into()]).is_err());
|
||||
let mut i = input();
|
||||
i.script_variants[0].script_utf8.push('x');
|
||||
assert!(target_action(&i, &["linux.base/1".into()]).is_err());
|
||||
let mut i = input();
|
||||
i.script_variants.remove(1);
|
||||
assert!(target_action(&i, &["windows.base/1".into()]).is_err());
|
||||
}
|
||||
#[tokio::test]
|
||||
#[ignore = "requires dedicated isolated PostgreSQL; tests/windows_plan_database.py"]
|
||||
async fn windows_plan_caps_persisted_database() {
|
||||
let admin = sqlx::PgPool::connect(&std::env::var("RMM_TEST_REPAIR_ADMIN_URL").unwrap())
|
||||
.await
|
||||
.unwrap();
|
||||
let pool = sqlx::PgPool::connect(&std::env::var("RMM_TEST_REPAIR_APP_URL").unwrap())
|
||||
.await
|
||||
.unwrap();
|
||||
rmm_persistence::verify_application_role(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
let tenant = Uuid::new_v4();
|
||||
sqlx::query("INSERT INTO tenants(tenant_id,name) VALUES($1,'isolated Windows contract')")
|
||||
.bind(tenant)
|
||||
.execute(&admin)
|
||||
.await
|
||||
.unwrap();
|
||||
let principal = Principal {
|
||||
tenant,
|
||||
name: "windows-contract".into(),
|
||||
operator: true,
|
||||
session_hash: None,
|
||||
csrf: None,
|
||||
scopes: None,
|
||||
testsimulation: false,
|
||||
identity: None,
|
||||
tenants: vec![tenant],
|
||||
};
|
||||
sqlx::query("INSERT INTO memberships VALUES($1,$2,'automation',ARRAY['operations:plan','operations:submit','operations:read','scripts:execute'],NULL)").bind(tenant).bind(&principal.name).execute(&admin).await.unwrap();
|
||||
let windows_caps = json!([
|
||||
"windows.base/1",
|
||||
"rmm.sync.v1",
|
||||
"run_script",
|
||||
"script.powershell/1"
|
||||
]);
|
||||
let mut assets = Vec::new();
|
||||
let mut agents = Vec::new();
|
||||
for caps in [json!(["linux.base/1", "run_script"]), windows_caps.clone()] {
|
||||
let asset = Uuid::new_v4();
|
||||
let agent = Uuid::new_v4();
|
||||
assets.push(asset);
|
||||
agents.push(agent);
|
||||
sqlx::query("INSERT INTO assets(tenant_id,asset_id) VALUES($1,$2)")
|
||||
.bind(tenant)
|
||||
.bind(asset)
|
||||
.execute(&admin)
|
||||
.await
|
||||
.unwrap();
|
||||
sqlx::query("INSERT INTO agent_installations(tenant_id,agent_id,asset_id,certificate_sha256,capabilities,connection_generation) VALUES($1,$2,$3,$4,$5,1)").bind(tenant).bind(agent).bind(asset).bind(hash(agent.as_bytes())).bind(caps).execute(&admin).await.unwrap();
|
||||
}
|
||||
let temp = std::path::PathBuf::from(format!("/tmp/windows-contract-{}", Uuid::new_v4()));
|
||||
let state = crate::State {
|
||||
pool,
|
||||
signer: None,
|
||||
viewer_a: [0; 32],
|
||||
viewer_b: [1; 32],
|
||||
auth: std::sync::Arc::new(crate::auth::Auth::from_env("development").await.unwrap()),
|
||||
job_signer: std::sync::Arc::new(
|
||||
crate::job_signer::JobSigner::load_or_create(&temp.join("key.pem")).unwrap(),
|
||||
),
|
||||
};
|
||||
let mut request = input();
|
||||
request.targets.asset_ids = assets.clone();
|
||||
let view = plan(&state, &principal, tenant, request.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
let id = Uuid::parse_str(view["plan_id"].as_str().unwrap()).unwrap();
|
||||
let original: Vec<u8> =
|
||||
sqlx::query_scalar("SELECT payload FROM operation_plans WHERE plan_id=$1")
|
||||
.bind(id)
|
||||
.fetch_one(&admin)
|
||||
.await
|
||||
.unwrap();
|
||||
let bound: PlanPayload = serde_json::from_slice(&original).unwrap();
|
||||
assert_eq!(bound.jobs.len(), 2);
|
||||
for job in &bound.jobs {
|
||||
assert_eq!(hash(&encode(&job.payload).unwrap()), job.job_payload_hash);
|
||||
let expected = if job.payload.asset_id == assets[0] {
|
||||
"linux"
|
||||
} else {
|
||||
"windows"
|
||||
};
|
||||
assert_eq!(job.payload.action.script_platform(), Some(expected));
|
||||
}
|
||||
let pending = submit(
|
||||
&state,
|
||||
&principal,
|
||||
tenant,
|
||||
id,
|
||||
Submit {
|
||||
idempotency_key: "fixed-mixed".into(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(pending["approval_state"], "pending_approval");
|
||||
assert_eq!(pending["job_count"], 0);
|
||||
let mut tx = rmm_persistence::tenant_tx(&state.pool, tenant)
|
||||
.await
|
||||
.unwrap();
|
||||
recheck(&mut tx, &bound).await.unwrap();
|
||||
tx.rollback().await.unwrap();
|
||||
sqlx::query("UPDATE agent_installations SET capabilities=$2 WHERE agent_id=$1")
|
||||
.bind(agents[1])
|
||||
.bind(json!(["windows.base/1", "run_script", "rmm.sync.v1"]))
|
||||
.execute(&admin)
|
||||
.await
|
||||
.unwrap();
|
||||
let mut tx = rmm_persistence::tenant_tx(&state.pool, tenant)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
recheck(&mut tx, &bound).await.unwrap_err().1,
|
||||
"UNSUPPORTED_CAPABILITY"
|
||||
);
|
||||
tx.rollback().await.unwrap();
|
||||
assert_eq!(
|
||||
plan(&state, &principal, tenant, request.clone())
|
||||
.await
|
||||
.unwrap_err()
|
||||
.1,
|
||||
"UNSUPPORTED_CAPABILITY"
|
||||
);
|
||||
sqlx::query("UPDATE agent_installations SET capabilities=$2 WHERE agent_id=$1")
|
||||
.bind(agents[1])
|
||||
.bind(&windows_caps)
|
||||
.execute(&admin)
|
||||
.await
|
||||
.unwrap();
|
||||
let mut changed = bound.clone();
|
||||
changed.jobs[0].script_sha256 = Some("00".repeat(32));
|
||||
let mut tx = rmm_persistence::tenant_tx(&state.pool, tenant)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
recheck(&mut tx, &changed).await.unwrap_err().1,
|
||||
"PLAN_HASH_MISMATCH"
|
||||
);
|
||||
tx.rollback().await.unwrap();
|
||||
request.script_variants.clear();
|
||||
assert_eq!(
|
||||
plan(&state, &principal, tenant, request.clone())
|
||||
.await
|
||||
.unwrap_err()
|
||||
.1,
|
||||
"UNSUPPORTED_CAPABILITY"
|
||||
);
|
||||
request.targets.asset_ids = vec![assets[0]];
|
||||
plan(&state, &principal, tenant, request).await.unwrap();
|
||||
assert_eq!(
|
||||
plan(&state, &principal, Uuid::new_v4(), input())
|
||||
.await
|
||||
.unwrap_err()
|
||||
.1,
|
||||
"NOT_FOUND"
|
||||
);
|
||||
assert!(
|
||||
crate::job_gateway::next(&state, tenant, agents[1], 1)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
let counts:(i64,i64,i64)=sqlx::query_as("SELECT (SELECT count(*) FROM jobs WHERE tenant_id=$1),(SELECT count(*) FROM outbox WHERE tenant_id=$1),(SELECT count(*) FROM execution_permits WHERE tenant_id=$1)").bind(tenant).fetch_one(&admin).await.unwrap();
|
||||
assert_eq!(counts, (0, 0, 0));
|
||||
let after: Vec<u8> =
|
||||
sqlx::query_scalar("SELECT payload FROM operation_plans WHERE plan_id=$1")
|
||||
.bind(id)
|
||||
.fetch_one(&admin)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(original, after);
|
||||
std::fs::remove_dir_all(temp).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ pub async fn query(
|
||||
asset_ids: vec![i.asset_id],
|
||||
},
|
||||
action,
|
||||
script_variants: vec![],
|
||||
execution_identity: "agent_service".into(),
|
||||
schedule: crate::jobs::Schedule {
|
||||
not_before: Utc::now(),
|
||||
|
||||
Reference in New Issue
Block a user