Get existing config from file or return empty map if file doesn't exist.
(cmd_info: &CommandInfo)
| 278 | |
| 279 | /// Get existing config from file or return empty map if file doesn't exist. |
| 280 | fn 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 | } |
no test coverage detected