MCPcopy Create free account
hub / github.com/PowerShell/DSC / invoke_resolve

Function invoke_resolve

lib/dsc-lib/src/dscresources/command_resource.rs:723–743  ·  view source on GitHub ↗

Invoke the resolve operation on a resource # Arguments `resource` - The resource manifest `cwd` - The current working directory `input` - Input to the command # Returns `ResolveResult` - The result of the resolve operation # Errors Error returned if the resource does not successfully resolve the input

(resource: &DscResource, input: &str)

Source from the content-addressed store, hash-verified

721///
722/// Error returned if the resource does not successfully resolve the input
723pub fn invoke_resolve(resource: &DscResource, input: &str) -> Result<ResolveResult, DscError> {
724 let Some(manifest) = &resource.manifest else {
725 return Err(DscError::MissingManifest(resource.type_name.to_string()));
726 };
727 let Some(resolve) = &manifest.resolve else {
728 return Err(DscError::Operation(t!("dscresources.commandResource.resolveNotSupported", resource = &resource.type_name).to_string()));
729 };
730
731 let command_resource_info = CommandResourceInfo {
732 type_name: resource.type_name.clone(),
733 path: if resource.require_adapter.is_some() { Some(resource.path.clone()) } else { None },
734 };
735
736 let args = process_get_args(resolve.args.as_ref(), input, &command_resource_info);
737 let command_input = get_command_input(resolve.input.as_ref(), input)?;
738
739 info!("{}", t!("dscresources.commandResource.invokeResolveUsing", resource = &resource.type_name, executable = &resolve.executable));
740 let (_exit_code, stdout, _stderr) = invoke_command(&resolve.executable, args, command_input.stdin.as_deref(), Some(&resource.directory), command_input.env, manifest.exit_codes.as_ref())?;
741 let result: ResolveResult = serde_json::from_str(&stdout)?;
742 Ok(result)
743}
744
745/// Asynchronously invoke a command and return the exit code, stdout, and stderr.
746///

Callers 1

resolveMethod · 0.85

Calls 6

process_get_argsFunction · 0.85
get_command_inputFunction · 0.85
invoke_commandFunction · 0.70
OperationEnum · 0.50
from_strFunction · 0.50
as_refMethod · 0.45

Tested by

no test coverage detected