Skip to content

Commit 201ceca

Browse files
committed
refactor(docker): extract sandbox template validation
1 parent fe333b9 commit 201ceca

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • crates/openshell-driver-docker/src

crates/openshell-driver-docker/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,17 @@ impl DockerComputeDriver {
370370
.as_ref()
371371
.ok_or_else(|| Status::invalid_argument("sandbox.spec.template is required"))?;
372372

373+
Self::validate_sandbox_template(template)?;
374+
Self::validate_gpu_request(spec.gpu, config.supports_gpu)?;
375+
Ok(())
376+
}
377+
378+
fn validate_sandbox_template(template: &DriverSandboxTemplate) -> Result<(), Status> {
373379
if template.image.trim().is_empty() {
374380
return Err(Status::failed_precondition(
375381
"docker sandboxes require a template image",
376382
));
377383
}
378-
Self::validate_gpu_request(spec.gpu, config.supports_gpu)?;
379384
if !template.agent_socket_path.trim().is_empty() {
380385
return Err(Status::failed_precondition(
381386
"docker compute driver does not support template.agent_socket_path",

0 commit comments

Comments
 (0)