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

Function get_existing_config

resources/sshdconfig/src/set.rs:280–292  ·  view source on GitHub ↗

Get existing config from file or return empty map if file doesn't exist.

(cmd_info: &CommandInfo)

Source from the content-addressed store, hash-verified

278
279/// Get existing config from file or return empty map if file doesn't exist.
280fn get_existing_config(cmd_info: &CommandInfo) -> Result<Map<String, Value>, SshdConfigError> {
281 let mut get_cmd_info = cmd_info.clone();
282 get_cmd_info.include_defaults = false;
283 get_cmd_info.input = Map::new();
284 match get_sshd_settings(&get_cmd_info, false) {
285 Ok(config) => Ok(config),
286 Err(SshdConfigError::FileNotFound(_)) => {
287 // If file doesn't exist, create empty config
288 Ok(Map::new())
289 }
290 Err(e) => Err(e),
291 }
292}

Callers 2

set_sshd_config_repeatFunction · 0.85

Calls 2

get_sshd_settingsFunction · 0.85
newFunction · 0.50

Tested by

no test coverage detected