Skip to content

Commit cc1de2c

Browse files
committed
refactor(docker): extract sandbox template validation
1 parent 8601a9f commit cc1de2c

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
@@ -418,12 +418,17 @@ impl DockerComputeDriver {
418418
.as_ref()
419419
.ok_or_else(|| Status::invalid_argument("sandbox.spec.template is required"))?;
420420

421+
Self::validate_sandbox_template(template)?;
422+
Self::validate_gpu_request(spec.gpu, config.supports_gpu)?;
423+
Ok(())
424+
}
425+
426+
fn validate_sandbox_template(template: &DriverSandboxTemplate) -> Result<(), Status> {
421427
if template.image.trim().is_empty() {
422428
return Err(Status::failed_precondition(
423429
"docker sandboxes require a template image",
424430
));
425431
}
426-
Self::validate_gpu_request(spec.gpu, config.supports_gpu)?;
427432
if !template.agent_socket_path.trim().is_empty() {
428433
return Err(Status::failed_precondition(
429434
"docker compute driver does not support template.agent_socket_path",

0 commit comments

Comments
 (0)