fix: ansible in agent mode can use inventory.ini

This commit is contained in:
Ruben Fiszel
2025-05-06 11:57:08 +02:00
parent afc9cf5940
commit 9bdd301f52
+13 -16
View File
@@ -858,18 +858,16 @@ pub async fn handle_ansible_job(
let mut nsjail_extra_mounts = vec![];
if let Some(r) = reqs.as_ref() {
if let Some(db) = conn.as_sql() {
nsjail_extra_mounts = create_file_resources(
&job.id,
&job.workspace_id,
job_dir,
interpolated_args.as_ref(),
&r,
&client,
db,
)
.await?;
}
nsjail_extra_mounts = create_file_resources(
&job.id,
&job.workspace_id,
job_dir,
interpolated_args.as_ref(),
&r,
&client,
conn,
)
.await?;
for repo in &r.git_repos {
append_logs(
@@ -935,8 +933,7 @@ pub async fn handle_ansible_job(
if let Some(collections) = r.roles_and_collections.as_ref() {
let empty = String::new();
let (lockfile, logs) =
req_lockfiles
let (lockfile, logs) = req_lockfiles
.as_ref()
.map(|r| (&r.collections_and_roles, &r.collections_and_roles_logs))
.unwrap_or((collections, &empty));
@@ -1162,7 +1159,7 @@ async fn create_file_resources(
args: Option<&HashMap<String, Box<RawValue>>>,
r: &AnsibleRequirements,
client: &crate::AuthedClient,
db: &sqlx::Pool<sqlx::Postgres>,
conn: &Connection,
) -> error::Result<Vec<String>> {
let mut logs = String::new();
let mut nsjail_mounts: Vec<String> = vec![];
@@ -1232,7 +1229,7 @@ async fn create_file_resources(
file_res.target_path, file_res.resource_path
));
}
append_logs(job_id, w_id, logs, &Connection::Sql(db.clone())).await;
append_logs(job_id, w_id, logs, conn).await;
Ok(nsjail_mounts)
}