Skip to main content

resolve

Function resolve 

Source
pub fn resolve(
    host: &str,
    paths: &SshConfigPaths,
) -> Result<ResolvedSshConfig, AnvilError>
Expand description

Resolves the effective ssh_config for host against the files listed in paths.

Reads the user file first, then the system file (per ssh_config(5): “first obtained value for each parameter is used”). Within each file, Include directives are recursively expanded (see [super::include::expand_includes]) before host matching.

Missing files are silently skipped — only failures to read an existing file (permission denied, malformed UTF-8, etc.) bubble up as errors.

§Errors

Returns AnvilError::invalid_config when:

  • A read of an existing file fails for reasons other than “not found”.
  • The file is not valid UTF-8.
  • The file is malformed (unterminated quote, Host with no patterns, Include cycle, depth overflow).
  • A directive’s argument fails to parse (e.g. Port abc).