MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / require_engine_available

Function require_engine_available

e2e/rust/src/harness/container.rs:286–322  ·  view source on GitHub ↗
(
    engine: &str,
    probe: &impl ContainerEngineProbe,
)

Source from the content-addressed store, hash-verified

284}
285
286fn require_engine_available(
287 engine: &str,
288 probe: &impl ContainerEngineProbe,
289) -> Result<ResolvedContainerEngine, String> {
290 match engine {
291 "docker" => {
292 if !probe.command_exists("docker") {
293 return Err(
294 "CONTAINER_ENGINE=docker requires the docker CLI to be installed and in PATH"
295 .to_string(),
296 );
297 }
298 if probe.docker_is_podman_shim() {
299 return Err(
300 "CONTAINER_ENGINE=docker was requested, but docker appears to be a Podman compatibility shim"
301 .to_string(),
302 );
303 }
304 Ok(ResolvedContainerEngine::new("docker", "docker"))
305 }
306 "podman" => {
307 if probe.command_exists("podman") {
308 Ok(ResolvedContainerEngine::new("podman", "podman"))
309 } else if probe.docker_is_podman_shim() {
310 Ok(ResolvedContainerEngine::new("podman", "docker"))
311 } else {
312 Err(
313 "CONTAINER_ENGINE=podman requires the podman CLI or a docker-compatible Podman shim to be installed and in PATH"
314 .to_string(),
315 )
316 }
317 }
318 _ => Err(format!(
319 "CONTAINER_ENGINE={engine} is invalid; expected docker or podman"
320 )),
321 }
322}
323
324fn auto_detect_container_engine(
325 probe: &impl ContainerEngineProbe,

Callers 1

resolve_container_engineFunction · 0.85

Calls 2

command_existsMethod · 0.80
docker_is_podman_shimMethod · 0.80

Tested by

no test coverage detected