diff --git a/crates/containerd-shim-wasmedge/src/executor.rs b/crates/containerd-shim-wasmedge/src/executor.rs index 0660cb11f..4612a4313 100644 --- a/crates/containerd-shim-wasmedge/src/executor.rs +++ b/crates/containerd-shim-wasmedge/src/executor.rs @@ -55,15 +55,15 @@ impl Executor for WasmEdgeExecutor { fn can_handle(&self, spec: &Spec) -> bool { // check if the entrypoint of the spec is a wasm binary. - let args = oci::get_args(spec); - if args.is_empty() { - return false; - } - - let start = args[0].clone(); - let mut iterator = start.split('#'); - let cmd = iterator.next().unwrap().to_string(); - let path = PathBuf::from(cmd); + let (module_name, _method) = oci::get_module(spec); + let module_name = match module_name { + Some(m) => m, + None => { + log::info!("WasmEdge cannot handle this workload, no arguments provided"); + return false; + } + }; + let path = PathBuf::from(module_name); path.extension() .map(|ext| ext.to_ascii_lowercase()) diff --git a/crates/containerd-shim-wasmtime/src/executor.rs b/crates/containerd-shim-wasmtime/src/executor.rs index 1f935afb0..ab7b938bc 100644 --- a/crates/containerd-shim-wasmtime/src/executor.rs +++ b/crates/containerd-shim-wasmtime/src/executor.rs @@ -57,15 +57,15 @@ impl Executor for WasmtimeExecutor { fn can_handle(&self, spec: &Spec) -> bool { // check if the entrypoint of the spec is a wasm binary. - let args = oci::get_args(spec); - if args.is_empty() { - return false; - } - - let start = args[0].clone(); - let mut iterator = start.split('#'); - let cmd = iterator.next().unwrap().to_string(); - let path = PathBuf::from(cmd); + let (module_name, _method) = oci::get_module(spec); + let module_name = match module_name { + Some(m) => m, + None => { + log::info!("Wasmtime cannot handle this workload, no arguments provided"); + return false; + } + }; + let path = PathBuf::from(module_name); // TODO: do we need to validate the wasm binary? // ```rust